k8s安装

作者: DifferentMan | 来源:发表于2020-03-11 11:44 被阅读0次

    1.安装

    #apt install docker.io
    #apt install -y apt-transport-https ca-certificates curl software-properties-common
    #curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -
    #curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
    #cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
    deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
    EOF
    
    #apt update
    #apt install kubelet kubeadm kubectl
    

    2.部署

    systemd enable docker

    kubeadm init --apiserver-advertise-address 192.168.50.105 --pod-network-cidr=10.244.0.0/16

    error1:
    [ERROR Swap]: running with swap on is not supported. Please disable swap

    swapoff -a

    error2:
    [ERROR Port-10251]: Port 10251 is in use

    kubeadm reset

    3.配置kubectl
    不推荐root用户继续
    mkdir -pHOME/.kube
    sudo cp -i /etc/kubernetes/admin.confHOME/.kube/config
    sudo chown(id -u):(id -g)HOME/.kube/config
    echo "source <(kubectl completion bash)" >> ~/.bashrc 4.安装pod网络kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
    5.添加k8s-node1和k8s-node2
    $kubeadm token list

    相关文章

      网友评论

          本文标题:k8s安装

          本文链接:https://www.haomeiwen.com/subject/kqeqjhtx.html