kubeadm搭建单master-多node节点k8s集群 (9)

修改如下内容:

1) 把--bind-address=127.0.0.1变成--bind-address=192.168.40.180 2) 把httpGet:字段下的hosts由127.0.0.1变成192.168.40.180 3) 把—port=0删除 #注意:192.168.40.180是k8s的控制节点k8s-master1的ip

3)kube-controller-manager配置修改

[root@k8s-master1 ~]# vim /etc/kubernetes/manifests/kube-controller-manager.yaml apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: component: kube-controller-manager tier: control-plane name: kube-controller-manager namespace: kube-system spec: containers: - command: - kube-controller-manager - --allocate-node-cidrs=true - --authentication-kubeconfig=http://www.likecs.com/etc/kubernetes/controller-manager.conf - --authorization-kubeconfig=http://www.likecs.com/etc/kubernetes/controller-manager.conf - --bind-address=192.168.40.180 - --client-ca-file=http://www.likecs.com/etc/kubernetes/pki/ca.crt - --cluster-cidr=10.244.0.0/16 - --cluster-name=kubernetes - --cluster-signing-cert-file=http://www.likecs.com/etc/kubernetes/pki/ca.crt - --cluster-signing-key-file=http://www.likecs.com/etc/kubernetes/pki/ca.key - --controllers=*,bootstrapsigner,tokencleaner - --kubeconfig=http://www.likecs.com/etc/kubernetes/controller-manager.conf - --leader-elect=true - --requestheader-client-ca-file=http://www.likecs.com/etc/kubernetes/pki/front-proxy-ca.crt - --root-ca-file=http://www.likecs.com/etc/kubernetes/pki/ca.crt - --service-account-private-key-file=http://www.likecs.com/etc/kubernetes/pki/sa.key - --service-cluster-ip-range=10.96.0.0/12 - --use-service-account-credentials=true image: registry.aliyuncs.com/google_containers/kube-controller-manager:v1.20.6 imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 8 httpGet: host: 192.168.40.180 path: /healthz port: 10257 scheme: HTTPS initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 15 name: kube-controller-manager resources: requests: cpu: 200m startupProbe: failureThreshold: 24 httpGet: host: 192.168.40.180 path: /healthz port: 10257 scheme: HTTPS initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 15 volumeMounts: - mountPath: /etc/ssl/certs name: ca-certs readOnly: true - mountPath: /etc/pki name: etc-pki readOnly: true - mountPath: /usr/libexec/kubernetes/kubelet-plugins/volume/exec name: flexvolume-dir - mountPath: /etc/kubernetes/pki name: k8s-certs readOnly: true - mountPath: /etc/kubernetes/controller-manager.conf name: kubeconfig readOnly: true hostNetwork: true priorityClassName: system-node-critical volumes: - hostPath: path: /etc/ssl/certs type: DirectoryOrCreate name: ca-certs - hostPath: path: /etc/pki type: DirectoryOrCreate name: etc-pki - hostPath: path: /usr/libexec/kubernetes/kubelet-plugins/volume/exec type: DirectoryOrCreate name: flexvolume-dir - hostPath: path: /etc/kubernetes/pki type: DirectoryOrCreate name: k8s-certs - hostPath: path: /etc/kubernetes/controller-manager.conf type: FileOrCreate name: kubeconfig status: {}

修改如下内容:

1) 把--bind-address=127.0.0.1变成--bind-address=192.168.40.180 2) 把httpGet:字段下的hosts由127.0.0.1变成192.168.40.180 3) 把—port=0删除 #注意:192.168.40.180是k8s的控制节点k8s-master1的ip

4)重启kubelet

[root@k8s-master1 ~]# systemctl restart kubelet [root@k8s-master1 ~]# kubectl get cs Warning: v1 ComponentStatus is deprecated in v1.19+ NAME STATUS MESSAGE ERROR scheduler Healthy ok controller-manager Healthy ok etcd-0 Healthy {"health":"true"} [root@k8s-master1 ~]# ss -antulp | grep :10251 tcp LISTEN 0 128 :::10251 :::* users:(("kube-scheduler",pid=122787,fd=7)) [root@k8s-master1 ~]# ss -antulp | grep :10252 tcp LISTEN 0 128 :::10252 :::* users:(("kube-controller",pid=125280,fd=7))

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zgzwdw.html