美文网首页
5. Kubernetes 安装node加入集群

5. Kubernetes 安装node加入集群

作者: 飞跑的蛤蟆 | 来源:发表于2019-06-27 20:04 被阅读0次

    1. 配置镜像加速支持

    2. 添加kubernetes的阿里巴巴源

    cat <<EOF > /etc/yum.repos.d/kubernetes.repo
    [kubernetes]
    name=Kubernetes
    baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
    enabled=1
    gpgcheck=1
    repo_gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
    EOF
    

    重新生成yum本地缓存

    yum makecache fast
    
    image.png
    image.png

    3. 安装kubeadm和相关工具

    yum install kubelet-1.14.0 kubeadm-1.14.0 --disableexcludes=kubernetes
    
    image.png
    image.png

    启动kubelet和docker并将其设置为开机自启动

    systemctl enable docker && systemctl start docker
    systemctl enable kubelet && systemctl start kubelet
    
    image.png

    4.为kubeadm命令生成配置文件

    kubeadm config print init-defaults > init.defaults.yaml
    cp init.defaults.yaml join-config.yaml
    
    # join-config.yaml
    apiVerision: kubeadm.k8s.io.v1beta1
    kind: JoinConfiguration
    discovery:
      bootstrapToken:
        apiServerEndpoint: 192.168.32.138:6443
        token: lpqedc.ur4t7ta4tj6oal1x
    
    image.png
    image.png

    5. 执行kubeadm join命令,将本node加入集群

    image.png
    [preflight] Running pre-flight checks
        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
    [preflight] Reading configuration from the cluster...
    [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
    [kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.14" ConfigMap in the kube-system namespace
    [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
    [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
    [kubelet-start] Activating the kubelet service
    [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
    
    This node has joined the cluster:
    * Certificate signing request was sent to apiserver and a response was received.
    * The Kubelet was informed of the new secure connection details.
    
    Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
    
    

    相关文章

      网友评论

          本文标题:5. Kubernetes 安装node加入集群

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