当前位置:  首页>> 技术小册>> Kubernetes合辑1-安装Kubernetes

  1. [root@master-81 ~]# kubeadm init --control-plane-endpoint "10.4.7.80:6443" --pod-network-cidr 10.200.0.0/16 --service-cidr 10.100.0.0/16 --image-repository registry.aliyuncs.com/google_containers --upload-certs --apiserver-cert-extra-sans k8s-local-01.huanle.com --apiserver-cert-extra-sans k8s-local.huanle.com
  2. Your Kubernetes control-plane has initialized successfully!
  3. To start using your cluster, you need to run the following as a regular user:
  4. mkdir -p $HOME/.kube
  5. sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  6. sudo chown $(id -u):$(id -g) $HOME/.kube/config
  7. Alternatively, if you are the root user, you can run:
  8. export KUBECONFIG=/etc/kubernetes/admin.conf
  9. You should now deploy a pod network to the cluster.
  10. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  11. https://kubernetes.io/docs/concepts/cluster-administration/addons/
  12. You can now join any number of the control-plane node running the following command on each as root:
  13. kubeadm join 10.4.7.80:6443 --token uyl0l1.j6a6b6bng2ofacnd \
  14. --discovery-token-ca-cert-hash sha256:8d53c43c27b24cd882683e53a6be0e21a7d59b0bc4e70feee0244a2a60c61b1c \
  15. --control-plane --certificate-key 493949abeee92288565f34526541dece387aa23ac4c58d1fecebd55de02a5426
  16. Please note that the certificate-key gives access to cluster sensitive data, keep it secret!
  17. As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use
  18. "kubeadm init phase upload-certs --upload-certs" to reload certs afterward.
  19. Then you can join any number of worker nodes by running the following on each as root:
  20. kubeadm join 10.4.7.80:6443 --token uyl0l1.j6a6b6bng2ofacnd \
  21. --discovery-token-ca-cert-hash sha256:8d53c43c27b24cd882683e53a6be0e21a7d59b0bc4e70feee0244a2a60c61b1c

该分类下的相关小册推荐: