日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

cento7.6安装kubernetes1.14.1

發布時間:2025/3/21 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cento7.6安装kubernetes1.14.1 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1 .準備:兩臺虛擬機maste.lab.example.com 192.168.125.142 2cpu 2G 60G
node.lab.example.com 192.168.125.141 2cpu 4G 60G

  • 更新軟件包及源
    更新軟件包 yum update -y
    新增源 :cd /etc/yum.repos.d
    mv CentOS-Base.repo CentOS-Base.repo.bak
    curl -o CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/CentOS-Base.repo
    curl -o docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    cat <<EOF > /etc/yum.repos.d/kubernetes.repo
    [kubernetes]
    name=Kubernetes
    baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
    enabled=1
    gpgcheck=0
    repo_gpgcheck=0
    gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
    http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
    EOF
    yum clean all && yum makecache
  • 系統設置
    關閉selinux和firewalld
    setenforce 0
    sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
    systemctl stop firewalld && systemctl disable firewalld
    修改內核參數
    cat <<EOF > /etc/sysctl.d/k8s.conf
    net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    EOF
  • sysctl -p
    加載內核模塊
    modprobe br_netfilter
    lsmod | grep br_netfilter
    禁用swap
    swapoff -a
    echo "vm.swappiness = 0">> /etc/sysctl.conf
    sysctl -p

  • 安裝docker
    yum install docker-ce
    設置鏡像加速器(這里我使用了自己個人的阿里云鏡像加速,根據個人實際情況來寫)
    mkdir -p /etc/docker
    tee /etc/docker/daemon.json <<-'EOF'
    {
    "registry-mirrors": ["https://o9ofxrn0.mirror.aliyuncs.com"]
    }
    EOF
    systemctl daemon-reload
    systemctl restart docker && systemctl enable docker
  • 加載鏡像
    由于國內網絡已被墻,我在這里事先吧1.14.1的鏡像提供出來
    鏈接:https://pan.baidu.com/s/1QkRoRHLFJxrQHAuslpFN4Q
    提取碼:ovgt
    復制這段內容后打開百度網盤手機App,操作更方便哦
  • 安裝kubeadm、kubelet和kubectl
    yum install -y kubelet kubeadm kubectl
    注:我這里現在yum源中是1.14.1的版本,之后會有更新的版本,如果是更高或者是其他版本,我這里提供的鏡像就不能用了。
    kubeadm init --pod-network-cidr=10.244.0.0/16
    跑完上面的init命令后會看到類似如下的輸出:
    Your Kubernetes master has initialized successfully!
  • To start using your cluster, you need to run the following as a regular user:

    mkdir -p $HOME/.kube
    sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
    sudo chown $(id -u):$(id -g) $HOME/.kube/config

    You should now deploy a pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
    https://kubernetes.io/docs/concepts/cluster-administration/addons/

    You can now join any number of machines by running the following on each node
    as root:
    kubeadm join 192.168.125.142:6443 --token 5fasbl.ctmnsuq04udlb8t2 \
    --discovery-token-ca-cert-hash sha256:c7fea93fa4ebcc695a48720fb007185102167bbd7f7ff9d2be178efdee20dad0
    接下來你懂的,該怎么做!!!

    轉載于:https://blog.51cto.com/ivanfcl/2392421

    總結

    以上是生活随笔為你收集整理的cento7.6安装kubernetes1.14.1的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。