今天安裝k8sV1.16的版本時候,執行突然發現命令不對,之前安裝V1.15的時候是可以的,可能是版本升級的原因。
解決:
unknown flag: --experimental-upload-certs,將–experimental-upload-certs 替換為 --upload-certs
1 root@kubernetes-master:/usr/local/docker/kubernetes# kubeadm init --config=kubeadm.yml --experimental-upload-certs | tee kubeadm-init.log 2 unknown flag: --experimental-upload-certs 3 To see the stack trace of this error execute with --v=5 or higher
---->>
1 root@kubernetes-master:/usr/local/docker/kubernetes# kubeadm init --config=kubeadm.yml --upload-certs | tee kubeadm-init.log 2 W0721 14:31:13.244686 16974 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io] 3 [init] Using Kubernetes version: v1.18.0 4 [preflight] Running pre-flight checks 5 [WARNING Firewalld]: firewalld is active, please ensure ports [6443 10250] are open or your cluster may not function correctly 6 [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/ 7 [preflight] Pulling images required for setting up a Kubernetes cluster 8 [preflight] This might take a minute or two, depending on the speed of your internet connection 9 [preflight] You can also perform this action in beforehand using 'kubeadm config images pull' 10 [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" 11 [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" 12 [kubelet-start] Starting the kubelet 13 [certs] Using certificateDir folder "/etc/kubernetes/pki" 14 [certs] Generating "ca" certificate and key 15 [certs] Generating "apiserver" certificate and key 16 [certs] apiserver serving cert is signed for DNS names [kubernetes-master kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.152.126] 17 [certs] Generating "apiserver-kubelet-client" certificate and key 18 [certs] Generating "front-proxy-ca" certificate and key 19 [certs] Generating "front-proxy-client" certificate and key 20 [certs] Generating "etcd/ca" certificate and key 21 [certs] Generating "etcd/server" certificate and key 22 [certs] etcd/server serving cert is signed for DNS names [kubernetes-master localhost] and IPs [192.168.152.126 127.0.0.1 ::1] 23 [certs] Generating "etcd/peer" certificate and key 24 [certs] etcd/peer serving cert is signed for DNS names [kubernetes-master localhost] and IPs [192.168.152.126 127.0.0.1 ::1] 25 [certs] Generating "etcd/healthcheck-client" certificate and key 26 [certs] Generating "apiserver-etcd-client" certificate and key 27 [certs] Generating "sa" key and public key 28 [kubeconfig] Using kubeconfig folder "/etc/kubernetes" 29 [kubeconfig] Writing "admin.conf" kubeconfig file 30 [kubeconfig] Writing "kubelet.conf" kubeconfig file 31 [kubeconfig] Writing "controller-manager.conf" kubeconfig file 32 [kubeconfig] Writing "scheduler.conf" kubeconfig file 33 [control-plane] Using manifest folder "/etc/kubernetes/manifests" 34 [control-plane] Creating static Pod manifest for "kube-apiserver" 35 [control-plane] Creating static Pod manifest for "kube-controller-manager" 36 W0721 14:31:30.566373 16974 manifests.go:225] the default kube-apiserver authorization-mode is "Node,RBAC"; using "Node,RBAC" 37 [control-plane] Creating static Pod manifest for "kube-scheduler" 38 W0721 14:31:30.588675 16974 manifests.go:225] the default kube-apiserver authorization-mode is "Node,RBAC"; using "Node,RBAC" 39 [etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests" 40 [wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s 41 [kubelet-check] Initial timeout of 40s passed. 42 [apiclient] All control plane components are healthy after 64.095556 seconds 43 [upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace 44 [kubelet] Creating a ConfigMap "kubelet-config-1.18" in namespace kube-system with the configuration for the kubelets in the cluster 45 [upload-certs] Storing the certificates in Secret "kubeadm-certs" in the "kube-system" Namespace 46 [upload-certs] Using certificate key: 47 fa5f198a2a00ab73ad6db528a7609a6854218b8dd5f9ff16c12fe798cbc9d63c 48 [mark-control-plane] Marking the node kubernetes-master as control-plane by adding the label "node-role.kubernetes.io/master=''" 49 [mark-control-plane] Marking the node kubernetes-master as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule] 50 [bootstrap-token] Using token: abcdef.0123456789abcdef 51 [bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles 52 [bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to get nodes 53 [bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials 54 [bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token 55 [bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster 56 [bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace 57 [kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key 58 [addons] Applied essential addon: CoreDNS 59 [addons] Applied essential addon: kube-proxy 60 61 Your Kubernetes control-plane has initialized successfully! 62 63 To start using your cluster, you need to run the following as a regular user: 64 65 mkdir -p $HOME/.kube 66 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config 67 sudo chown $(id -u):$(id -g) $HOME/.kube/config 68 69 You should now deploy a pod network to the cluster. 70 Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: 71 https://kubernetes.io/docs/concepts/cluster-administration/addons/ 72 73 Then you can join any number of worker nodes by running the following on each as root: 74 75 kubeadm join 192.168.152.126:6443 --token abcdef.0123456789abcdef \ 76 --discovery-token-ca-cert-hash sha256:bb81898b14b7932d0807792de81a04d7501aaaa30db98dee2053ad12936bf5db 77 root@kubernetes-master:/usr/local/docker/kubernetes#