kubeadm 通过yaml文件初始化集群

[root@k8s-master1 ~]# cat kubeadm-config.yaml
apiVersion: kubeadm.k8s.io/v1beta3
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
token: abcdef.0123456789abcdef
ttl: 24h0m0s
usages:
- signing
- authentication
kind: InitConfiguration
#localAPIEndpoint:
# advertiseAddress: 1.2.3.4
# bindPort: 6443
nodeRegistration:
criSocket: unix:///var/run/cri-dockerd.sock
imagePullPolicy: IfNotPresent
# name: node
taints: null
---
apiServer:
timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta3
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controllerManager: {}
dns: {}
etcd:
local:
dataDir: /var/lib/etcd
imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers
kind: ClusterConfiguration
kubernetesVersion: 1.25.3
controlPlaneEndpoint: 192.168.0.100:16443
networking:
dnsDomain: cluster.local
serviceSubnet: 10.96.0.0/12
podSubnet: 10.244.0.0/16
scheduler: {}
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: ipvs
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: systemd

[root@k8s-master1 ~]# kubeadm init --config=kubeadm-config.yaml --v=6
I0309 14:15:50.939549 28798 initconfiguration.go:254] loading configuration from "kubeadm-config.yaml"
I0309 14:15:50.940911 28798 interface.go:432] Looking for default routes with IPv4 addresses
I0309 14:15:50.940919 28798 interface.go:437] Default route transits interface "eth0"
I0309 14:15:50.940974 28798 interface.go:209] Interface eth0 is up
I0309 14:15:50.941002 28798 interface.go:257] Interface "eth0" has 3 addresses :[192.168.0.126/24 192.168.0.100/24 fe80::f816:3eff:feaf:785/64].
I0309 14:15:50.941015 28798 interface.go:224] Checking addr 192.168.0.126/24.
I0309 14:15:50.941021 28798 interface.go:231] IP found 192.168.0.126
I0309 14:15:50.941026 28798 interface.go:263] Found valid IPv4 address 192.168.0.126 for interface "eth0".
I0309 14:15:50.941031 28798 interface.go:443] Found active IP 192.168.0.126
[init] Using Kubernetes version: v1.25.3
[preflight] Running pre-flight checks
I0309 14:15:50.943346 28798 checks.go:568] validating Kubernetes and kubeadm version
I0309 14:15:50.943359 28798 checks.go:168] validating if the firewall is enabled and active
I0309 14:15:50.947961 28798 checks.go:203] validating availability of port 6443
I0309 14:15:50.948049 28798 checks.go:203] validating availability of port 10259
I0309 14:15:50.948062 28798 checks.go:203] validating availability of port 10257
I0309 14:15:50.948074 28798 checks.go:280] validating the existence of file /etc/kubernetes/manifests/kube-apiserver.yaml
I0309 14:15:50.948081 28798 checks.go:280] validating the existence of file /etc/kubernetes/manifests/kube-controller-manager.yaml
I0309 14:15:50.948086 28798 checks.go:280] validating the existence of file /etc/kubernetes/manifests/kube-scheduler.yaml
I0309 14:15:50.948091 28798 checks.go:280] validating the existence of file /etc/kubernetes/manifests/etcd.yaml
I0309 14:15:50.948098 28798 checks.go:430] validating if the connectivity type is via proxy or direct
I0309 14:15:50.948121 28798 checks.go:469] validating http connectivity to first IP address in the CIDR
I0309 14:15:50.948130 28798 checks.go:469] validating http connectivity to first IP address in the CIDR
I0309 14:15:50.948138 28798 checks.go:104] validating the container runtime
I0309 14:15:50.974232 28798 checks.go:329] validating the contents of file /proc/sys/net/bridge/bridge-nf-call-iptables
I0309 14:15:50.974267 28798 checks.go:329] validating the contents of file /proc/sys/net/ipv4/ip_forward
I0309 14:15:50.974289 28798 checks.go:644] validating whether swap is enabled or not
I0309 14:15:50.974307 28798 checks.go:370] validating the presence of executable crictl
I0309 14:15:50.974321 28798 checks.go:370] validating the presence of executable conntrack
I0309 14:15:50.974330 28798 checks.go:370] validating the presence of executable ip
I0309 14:15:50.974337 28798 checks.go:370] validating the presence of executable iptables
I0309 14:15:50.974345 28798 checks.go:370] validating the presence of executable mount
I0309 14:15:50.974355 28798 checks.go:370] validating the presence of executable nsenter
I0309 14:15:50.974371 28798 checks.go:370] validating the presence of executable ebtables
I0309 14:15:50.974379 28798 checks.go:370] validating the presence of executable ethtool
I0309 14:15:50.974387 28798 checks.go:370] validating the presence of executable socat
I0309 14:15:50.974395 28798 checks.go:370] validating the presence of executable tc
I0309 14:15:50.974403 28798 checks.go:370] validating the presence of executable touch
I0309 14:15:50.974412 28798 checks.go:516] running all checks
I0309 14:15:50.980040 28798 checks.go:401] checking whether the given node name is valid and reachable using net.LookupHost
I0309 14:15:50.980147 28798 checks.go:610] validating kubelet version
I0309 14:15:51.017607 28798 checks.go:130] validating if the "kubelet" service is enabled and active
I0309 14:15:51.022961 28798 checks.go:203] validating availability of port 10250
I0309 14:15:51.023000 28798 checks.go:203] validating availability of port 2379
I0309 14:15:51.023012 28798 checks.go:203] validating availability of port 2380
I0309 14:15:51.023029 28798 checks.go:243] validating the existence and emptiness of directory /var/lib/etcd
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
I0309 14:15:51.023129 28798 checks.go:832] using image pull policy: IfNotPresent
I0309 14:15:51.047936 28798 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.25.3
I0309 14:15:51.072948 28798 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.25.3
I0309 14:15:51.095428 28798 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.25.3
I0309 14:15:51.118397 28798 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.25.3
I0309 14:15:51.141190 28798 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.8
I0309 14:15:51.163768 28798 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.5.4-0
I0309 14:15:51.186497 28798 checks.go:841] image exists: registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:v1.9.3
[certs] Using certificateDir folder "/etc/kubernetes/pki"
I0309 14:15:51.186561 28798 certs.go:112] creating a new certificate authority for ca
[certs] Generating "ca" certificate and key
I0309 14:15:51.416286 28798 certs.go:522] validating certificate period for ca certificate
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [k8s-master1 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.0.126 192.168.0.100]
[certs] Generating "apiserver-kubelet-client" certificate and key
I0309 14:15:51.691707 28798 certs.go:112] creating a new certificate authority for front-proxy-ca
[certs] Generating "front-proxy-ca" certificate and key
I0309 14:15:51.814675 28798 certs.go:522] validating certificate period for front-proxy-ca certificate
[certs] Generating "front-proxy-client" certificate and key
I0309 14:15:51.921949 28798 certs.go:112] creating a new certificate authority for etcd-ca
[certs] Generating "etcd/ca" certificate and key
I0309 14:15:51.972985 28798 certs.go:522] validating certificate period for etcd/ca certificate
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [k8s-master1 localhost] and IPs [192.168.0.126 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [k8s-master1 localhost] and IPs [192.168.0.126 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
I0309 14:15:52.475029 28798 certs.go:78] creating new public/private key files for signing service account users
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
I0309 14:15:52.542939 28798 kubeconfig.go:103] creating kubeconfig file for admin.conf
W0309 14:15:52.543047 28798 endpoint.go:57] [endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "admin.conf" kubeconfig file
I0309 14:15:52.943707 28798 kubeconfig.go:103] creating kubeconfig file for kubelet.conf
W0309 14:15:52.943807 28798 endpoint.go:57] [endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "kubelet.conf" kubeconfig file
I0309 14:15:52.985076 28798 kubeconfig.go:103] creating kubeconfig file for controller-manager.conf
W0309 14:15:52.985153 28798 endpoint.go:57] [endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
I0309 14:15:53.055832 28798 kubeconfig.go:103] creating kubeconfig file for scheduler.conf
W0309 14:15:53.055917 28798 endpoint.go:57] [endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
[kubeconfig] Writing "scheduler.conf" kubeconfig file
I0309 14:15:53.155572 28798 kubelet.go:66] Stopping the kubelet
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
I0309 14:15:53.214023 28798 manifests.go:99] [control-plane] getting StaticPodSpecs
I0309 14:15:53.214184 28798 certs.go:522] validating certificate period for CA certificate
I0309 14:15:53.214241 28798 manifests.go:125] [control-plane] adding volume "ca-certs" for component "kube-apiserver"
I0309 14:15:53.214246 28798 manifests.go:125] [control-plane] adding volume "etc-pki" for component "kube-apiserver"
I0309 14:15:53.214251 28798 manifests.go:125] [control-plane] adding volume "k8s-certs" for component "kube-apiserver"
I0309 14:15:53.215763 28798 manifests.go:154] [control-plane] wrote static Pod manifest for component "kube-apiserver" to "/etc/kubernetes/manifests/kube-apiserver.yaml"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
I0309 14:15:53.215775 28798 manifests.go:99] [control-plane] getting StaticPodSpecs
I0309 14:15:53.215894 28798 manifests.go:125] [control-plane] adding volume "ca-certs" for component "kube-controller-manager"
I0309 14:15:53.215900 28798 manifests.go:125] [control-plane] adding volume "etc-pki" for component "kube-controller-manager"
I0309 14:15:53.215905 28798 manifests.go:125] [control-plane] adding volume "flexvolume-dir" for component "kube-controller-manager"
I0309 14:15:53.215910 28798 manifests.go:125] [control-plane] adding volume "k8s-certs" for component "kube-controller-manager"
I0309 14:15:53.215914 28798 manifests.go:125] [control-plane] adding volume "kubeconfig" for component "kube-controller-manager"
I0309 14:15:53.216325 28798 manifests.go:154] [control-plane] wrote static Pod manifest for component "kube-controller-manager" to "/etc/kubernetes/manifests/kube-controller-manager.yaml"
[control-plane] Creating static Pod manifest for "kube-scheduler"
I0309 14:15:53.216335 28798 manifests.go:99] [control-plane] getting StaticPodSpecs
I0309 14:15:53.216439 28798 manifests.go:125] [control-plane] adding volume "kubeconfig" for component "kube-scheduler"
I0309 14:15:53.216718 28798 manifests.go:154] [control-plane] wrote static Pod manifest for component "kube-scheduler" to "/etc/kubernetes/manifests/kube-scheduler.yaml"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
I0309 14:15:53.217105 28798 local.go:65] [etcd] wrote Static Pod manifest for a local etcd member to "/etc/kubernetes/manifests/etcd.yaml"
I0309 14:15:53.217114 28798 waitcontrolplane.go:83] [wait-control-plane] Waiting for the API server to be healthy
I0309 14:15:53.217485 28798 loader.go:374] Config loaded from file: /etc/kubernetes/admin.conf
[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
I0309 14:15:53.218416 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:15:54.218536 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 1 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:15:54.218957 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:15:55.219581 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 2 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:15:55.219981 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:15:56.220592 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 3 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:15:56.220978 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:15:57.222591 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 4 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:15:57.222945 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:15:58.223205 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 5 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:15:58.223580 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:15:59.224426 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 6 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:15:59.224900 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:16:00.225660 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 7 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:16:00.226100 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:16:01.226493 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 8 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:16:01.226917 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:16:02.227658 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 9 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:16:02.228083 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:16:03.729780 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s in 0 milliseconds
I0309 14:16:04.729971 28798 with_retry.go:242] Got a Retry-After 1s response for attempt 1 to https://192.168.0.100:16443/healthz?timeout=10s
I0309 14:16:04.735136 28798 round_trippers.go:553] GET https://192.168.0.100:16443/healthz?timeout=10s 200 OK in 5 milliseconds
[apiclient] All control plane components are healthy after 11.517345 seconds
I0309 14:16:04.735201 28798 uploadconfig.go:110] [upload-config] Uploading the kubeadm ClusterConfiguration to a ConfigMap
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
I0309 14:16:04.737294 28798 round_trippers.go:553] POST https://192.168.0.100:16443/api/v1/namespaces/kube-system/configmaps?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:04.738957 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/namespaces/kube-system/roles?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:04.740537 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/namespaces/kube-system/rolebindings?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:04.740644 28798 uploadconfig.go:124] [upload-config] Uploading the kubelet component config to a ConfigMap
[kubelet] Creating a ConfigMap "kubelet-config" in namespace kube-system with the configuration for the kubelets in the cluster
I0309 14:16:04.745927 28798 round_trippers.go:553] POST https://192.168.0.100:16443/api/v1/namespaces/kube-system/configmaps?timeout=10s 201 Created in 4 milliseconds
I0309 14:16:04.747370 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/namespaces/kube-system/roles?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:04.748706 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/namespaces/kube-system/rolebindings?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:04.748776 28798 uploadconfig.go:129] [upload-config] Preserving the CRISocket information for the control-plane node
I0309 14:16:04.748788 28798 patchnode.go:31] [patchnode] Uploading the CRI Socket information "unix:///var/run/cri-dockerd.sock" to the Node API object "k8s-master1" as an annotation
I0309 14:16:05.250731 28798 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/nodes/k8s-master1?timeout=10s 404 Not Found in 1 milliseconds
I0309 14:16:05.750697 28798 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/nodes/k8s-master1?timeout=10s 404 Not Found in 1 milliseconds
I0309 14:16:06.250154 28798 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/nodes/k8s-master1?timeout=10s 404 Not Found in 1 milliseconds
I0309 14:16:06.750987 28798 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/nodes/k8s-master1?timeout=10s 404 Not Found in 1 milliseconds
I0309 14:16:07.250975 28798 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/nodes/k8s-master1?timeout=10s 404 Not Found in 1 milliseconds
I0309 14:16:07.753030 28798 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/nodes/k8s-master1?timeout=10s 200 OK in 3 milliseconds
I0309 14:16:07.756473 28798 round_trippers.go:553] PATCH https://192.168.0.100:16443/api/v1/nodes/k8s-master1?timeout=10s 200 OK in 2 milliseconds
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node k8s-master1 as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[mark-control-plane] Marking the node k8s-master1 as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]
I0309 14:16:08.258928 28798 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/nodes/k8s-master1?timeout=10s 200 OK in 1 milliseconds
I0309 14:16:08.262303 28798 round_trippers.go:553] PATCH https://192.168.0.100:16443/api/v1/nodes/k8s-master1?timeout=10s 200 OK in 2 milliseconds
[bootstrap-token] Using token: abcdef.0123456789abcdef
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
I0309 14:16:08.264593 28798 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/namespaces/kube-system/secrets/bootstrap-token-abcdef?timeout=10s 404 Not Found in 1 milliseconds
I0309 14:16:08.266397 28798 round_trippers.go:553] POST https://192.168.0.100:16443/api/v1/namespaces/kube-system/secrets?timeout=10s 201 Created in 1 milliseconds
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes
I0309 14:16:08.267968 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/clusterroles?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.269379 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?timeout=10s 201 Created in 1 milliseconds
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
I0309 14:16:08.270768 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?timeout=10s 201 Created in 1 milliseconds
[bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
I0309 14:16:08.271956 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?timeout=10s 201 Created in 1 milliseconds
[bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
I0309 14:16:08.273677 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?timeout=10s 201 Created in 1 milliseconds
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
I0309 14:16:08.273751 28798 clusterinfo.go:47] [bootstrap-token] loading admin kubeconfig
I0309 14:16:08.274044 28798 loader.go:374] Config loaded from file: /etc/kubernetes/admin.conf
I0309 14:16:08.274052 28798 clusterinfo.go:58] [bootstrap-token] copying the cluster from admin.conf to the bootstrap kubeconfig
I0309 14:16:08.274194 28798 clusterinfo.go:70] [bootstrap-token] creating/updating ConfigMap in kube-public namespace
I0309 14:16:08.275514 28798 round_trippers.go:553] POST https://192.168.0.100:16443/api/v1/namespaces/kube-public/configmaps?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.275616 28798 clusterinfo.go:84] creating the RBAC rules for exposing the cluster-info ConfigMap in the kube-public namespace
I0309 14:16:08.276862 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/namespaces/kube-public/roles?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.280331 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/namespaces/kube-public/rolebindings?timeout=10s 201 Created in 3 milliseconds
I0309 14:16:08.280414 28798 kubeletfinalize.go:90] [kubelet-finalize] Assuming that kubelet client certificate rotation is enabled: found "/var/lib/kubelet/pki/kubelet-client-current.pem"
[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
I0309 14:16:08.280707 28798 loader.go:374] Config loaded from file: /etc/kubernetes/kubelet.conf
I0309 14:16:08.280943 28798 kubeletfinalize.go:134] [kubelet-finalize] Restarting the kubelet to enable client certificate rotation
I0309 14:16:08.339898 28798 round_trippers.go:553] GET https://192.168.0.100:16443/apis/apps/v1/namespaces/kube-system/deployments?labelSelector=k8s-app%3Dkube-dns 200 OK in 2 milliseconds
I0309 14:16:08.342601 28798 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/namespaces/kube-system/configmaps/coredns?timeout=10s 404 Not Found in 1 milliseconds
I0309 14:16:08.344445 28798 round_trippers.go:553] POST https://192.168.0.100:16443/api/v1/namespaces/kube-system/configmaps?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.346251 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/clusterroles?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.347828 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.349726 28798 round_trippers.go:553] POST https://192.168.0.100:16443/api/v1/namespaces/kube-system/serviceaccounts?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.354412 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/apps/v1/namespaces/kube-system/deployments?timeout=10s 201 Created in 4 milliseconds
I0309 14:16:08.360245 28798 round_trippers.go:553] POST https://192.168.0.100:16443/api/v1/namespaces/kube-system/services?timeout=10s 201 Created in 5 milliseconds
[addons] Applied essential addon: CoreDNS
W0309 14:16:08.360361 28798 endpoint.go:57] [endpoint] WARNING: port specified in controlPlaneEndpoint overrides bindPort in the controlplane address
I0309 14:16:08.362604 28798 round_trippers.go:553] POST https://192.168.0.100:16443/api/v1/namespaces/kube-system/configmaps?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.365982 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/apps/v1/namespaces/kube-system/daemonsets?timeout=10s 201 Created in 2 milliseconds
I0309 14:16:08.458268 28798 request.go:614] Waited for 92.070823ms due to client-side throttling, not priority and fairness, request: POST:https://192.168.0.100:16443/api/v1/namespaces/kube-system/serviceaccounts?timeout=10s
I0309 14:16:08.460053 28798 round_trippers.go:553] POST https://192.168.0.100:16443/api/v1/namespaces/kube-system/serviceaccounts?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.461694 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/clusterrolebindings?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.468375 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/namespaces/kube-system/roles?timeout=10s 201 Created in 1 milliseconds
I0309 14:16:08.666694 28798 request.go:614] Waited for 198.20597ms due to client-side throttling, not priority and fairness, request: POST:https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/namespaces/kube-system/rolebindings?timeout=10s
I0309 14:16:08.668455 28798 round_trippers.go:553] POST https://192.168.0.100:16443/apis/rbac.authorization.k8s.io/v1/namespaces/kube-system/rolebindings?timeout=10s 201 Created in 1 milliseconds
[addons] Applied essential addon: kube-proxy
I0309 14:16:08.668883 28798 loader.go:374] Config loaded from file: /etc/kubernetes/admin.conf
I0309 14:16:08.669238 28798 loader.go:374] Config loaded from file: /etc/kubernetes/admin.conf

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now join any number of control-plane nodes by copying certificate authorities
and service account keys on each node and then running the following as root:

kubeadm join 192.168.0.100:16443 --token abcdef.0123456789abcdef \
--discovery-token-ca-cert-hash sha256:8e859b3f8367c4b454f55a8ebff70e08516f9546dc306392e0053a783a78182c \
--control-plane

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 192.168.0.100:16443 --token abcdef.0123456789abcdef \
--discovery-token-ca-cert-hash sha256:8e859b3f8367c4b454f55a8ebff70e08516f9546dc306392e0053a783a78182c

加入普通worker node节点

[root@k8s-node1 ~]# systemctl restart docker
[root@k8s-node1 ~]# systemctl restart cri-docker
[root@k8s-node1 ~]# kubeadm join 192.168.0.100:16443 --token abcdef.0123456789abcdef --discovery-token-ca-cert-hash sha256:8e859b3f8367c4b454f55a8ebff70e08516f9546dc306392e0053a783a78182c --cri-socket unix:///var/run/cri-dockerd.sock --v=6
I0310 09:14:41.251855 8270 join.go:416] [preflight] found NodeName empty; using OS hostname as NodeName
[preflight] Running pre-flight checks
I0310 09:14:41.251965 8270 preflight.go:92] [preflight] Running general checks
I0310 09:14:41.251998 8270 checks.go:280] validating the existence of file /etc/kubernetes/kubelet.conf
I0310 09:14:41.252004 8270 checks.go:280] validating the existence of file /etc/kubernetes/bootstrap-kubelet.conf
I0310 09:14:41.252012 8270 checks.go:104] validating the container runtime
I0310 09:14:41.280982 8270 checks.go:329] validating the contents of file /proc/sys/net/bridge/bridge-nf-call-iptables
I0310 09:14:41.281041 8270 checks.go:329] validating the contents of file /proc/sys/net/ipv4/ip_forward
I0310 09:14:41.281064 8270 checks.go:644] validating whether swap is enabled or not
I0310 09:14:41.281082 8270 checks.go:370] validating the presence of executable crictl
I0310 09:14:41.281100 8270 checks.go:370] validating the presence of executable conntrack
I0310 09:14:41.281108 8270 checks.go:370] validating the presence of executable ip
I0310 09:14:41.281116 8270 checks.go:370] validating the presence of executable iptables
I0310 09:14:41.281125 8270 checks.go:370] validating the presence of executable mount
I0310 09:14:41.281134 8270 checks.go:370] validating the presence of executable nsenter
I0310 09:14:41.281142 8270 checks.go:370] validating the presence of executable ebtables
I0310 09:14:41.281150 8270 checks.go:370] validating the presence of executable ethtool
I0310 09:14:41.281157 8270 checks.go:370] validating the presence of executable socat
I0310 09:14:41.281166 8270 checks.go:370] validating the presence of executable tc
I0310 09:14:41.281177 8270 checks.go:370] validating the presence of executable touch
I0310 09:14:41.281187 8270 checks.go:516] running all checks
I0310 09:14:41.286121 8270 checks.go:401] checking whether the given node name is valid and reachable using net.LookupHost
I0310 09:14:41.286233 8270 checks.go:610] validating kubelet version
I0310 09:14:41.324019 8270 checks.go:130] validating if the "kubelet" service is enabled and active
I0310 09:14:41.328813 8270 checks.go:203] validating availability of port 10250
I0310 09:14:41.328922 8270 checks.go:280] validating the existence of file /etc/kubernetes/pki/ca.crt
I0310 09:14:41.328933 8270 checks.go:430] validating if the connectivity type is via proxy or direct
I0310 09:14:41.328961 8270 join.go:533] [preflight] Discovering cluster-info
I0310 09:14:41.328983 8270 token.go:80] [discovery] Created cluster-info discovery client, requesting info from "192.168.0.100:16443"
I0310 09:14:41.335040 8270 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/namespaces/kube-public/configmaps/cluster-info?timeout=10s 200 OK in 5 milliseconds
I0310 09:14:41.335681 8270 token.go:118] [discovery] Requesting info from "192.168.0.100:16443" again to validate TLS against the pinned public key
I0310 09:14:41.340422 8270 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/namespaces/kube-public/configmaps/cluster-info?timeout=10s 200 OK in 4 milliseconds
I0310 09:14:41.340647 8270 token.go:135] [discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server "192.168.0.100:16443"
I0310 09:14:41.340661 8270 discovery.go:52] [discovery] Using provided TLSBootstrapToken as authentication credentials for the join process
I0310 09:14:41.340679 8270 join.go:547] [preflight] Fetching init configuration
I0310 09:14:41.340683 8270 join.go:593] [preflight] Retrieving KubeConfig objects
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
I0310 09:14:41.342838 8270 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/namespaces/kube-system/configmaps/kubeadm-config?timeout=10s 200 OK in 1 milliseconds
I0310 09:14:41.344788 8270 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/namespaces/kube-system/configmaps/kube-proxy?timeout=10s 200 OK in 1 milliseconds
I0310 09:14:41.345587 8270 kubelet.go:74] attempting to download the KubeletConfiguration from ConfigMap "kubelet-config"
I0310 09:14:41.346933 8270 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/namespaces/kube-system/configmaps/kubelet-config?timeout=10s 200 OK in 1 milliseconds
I0310 09:14:41.347972 8270 interface.go:432] Looking for default routes with IPv4 addresses
I0310 09:14:41.347979 8270 interface.go:437] Default route transits interface "eth0"
I0310 09:14:41.348043 8270 interface.go:209] Interface eth0 is up
I0310 09:14:41.348066 8270 interface.go:257] Interface "eth0" has 2 addresses :[192.168.0.56/24 fe80::f816:3eff:feaf:73f/64].
I0310 09:14:41.348077 8270 interface.go:224] Checking addr 192.168.0.56/24.
I0310 09:14:41.348082 8270 interface.go:231] IP found 192.168.0.56
I0310 09:14:41.348088 8270 interface.go:263] Found valid IPv4 address 192.168.0.56 for interface "eth0".
I0310 09:14:41.348092 8270 interface.go:443] Found active IP 192.168.0.56
I0310 09:14:41.349982 8270 preflight.go:103] [preflight] Running configuration dependant checks
I0310 09:14:41.349994 8270 controlplaneprepare.go:220] [download-certs] Skipping certs download
I0310 09:14:41.350002 8270 kubelet.go:120] [kubelet-start] writing bootstrap kubelet config file at /etc/kubernetes/bootstrap-kubelet.conf
I0310 09:14:41.350355 8270 kubelet.go:135] [kubelet-start] writing CA certificate at /etc/kubernetes/pki/ca.crt
I0310 09:14:41.350519 8270 loader.go:374] Config loaded from file: /etc/kubernetes/bootstrap-kubelet.conf
I0310 09:14:41.350666 8270 kubelet.go:156] [kubelet-start] Checking for an existing Node in the cluster with name "k8s-node1" and status "Ready"
I0310 09:14:41.352060 8270 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/nodes/k8s-node1?timeout=10s 404 Not Found in 1 milliseconds
I0310 09:14:41.352200 8270 kubelet.go:171] [kubelet-start] Stopping the kubelet
[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] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
I0310 09:14:46.413454 8270 loader.go:374] Config loaded from file: /etc/kubernetes/kubelet.conf
I0310 09:14:46.413962 8270 cert_rotation.go:137] Starting client certificate rotation controller
I0310 09:14:46.414144 8270 loader.go:374] Config loaded from file: /etc/kubernetes/kubelet.conf
I0310 09:14:46.414334 8270 kubelet.go:219] [kubelet-start] preserving the crisocket information for the node
I0310 09:14:46.414345 8270 patchnode.go:31] [patchnode] Uploading the CRI Socket information "unix:///var/run/cri-dockerd.sock" to the Node API object "k8s-node1" as an annotation
I0310 09:14:46.920455 8270 round_trippers.go:553] GET https://192.168.0.100:16443/api/v1/nodes/k8s-node1?timeout=10s 200 OK in 5 milliseconds
I0310 09:14:46.926480 8270 round_trippers.go:553] PATCH https://192.168.0.100:16443/api/v1/nodes/k8s-node1?timeout=10s 200 OK in 5 milliseconds

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.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值