k8s命令

作者: Firetheworld | 来源:发表于2020-06-09 17:23 被阅读0次

    kubeadm config print init-defaults > kubeadm-config.yaml
    kubeadm config images list --config kubeadm-config.yaml
    kubeadm config images pull --config kubeadm-config.yaml

    500 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 update

    yum list kubelet --showduplicates | sort -r

    yum install kubelet.x86_64:1.16.1-0 --downloadonly --downloaddir=/root/k8srpm/
    yum install kubelet.x86_64_1.16.1-0 --downloadonly --downloaddir=/root/k8srpm/
    yum install kubelet.x86_64-1.16.1-0 --downloadonly --downloaddir=/root/k8srpm/
    yum install kubelet-1.16.1-0 --downloadonly --downloaddir=/root/k8srpm/

    k8s创建永久token

    [root@k8s-10-192-52-123 ~]# kubeadm token create --ttl 0
    e19fnk.h9a52kse0ernfh0u
    [root@k8s-10-192-52-123 ~]# kubeadm token list
    TOKEN                     TTL         EXPIRES   USAGES                   DESCRIPTION   EXTRA GROUPS
    e19fnk.h9a52kse0ernfh0u   <forever>   <never>   authentication,signing   <none>        system:bootstrappers:kubeadm:default-node-token
    [root@k8s-10-192-52-123 ~]# openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
    a030724a9437a9356a2b0b3d9ee8c5f287493f51c315c684c686b4a8c581a71f
    
    加入集群
    # kubeadm join 10.192.52.123:6443 --token e19fnk.h9a52kse0ernfh0u --discovery-token-ca-cert-hash sha256:a030724a9437a9356a2b0b3d9ee8c5f287493f51c315c684c686b4a8c581a71f
    

    相关文章

      网友评论

          本文标题:k8s命令

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