一、配置kubelet
1.配置启动文件
# cat > /usr/lib/systemd/system/kubelet.service <<EOF [Unit] Description=Kubernetes Kubelet After=docker.service Requires=docker.service [Service] EnvironmentFile=-/etc/kubernetes/kubelet ExecStart=/usr/bin/kubelet \$KUBELET_OPTS Restart=on-failure KillMode=process [Install] WantedBy=multi-user.targetEOF
2.配置kubelet参数文件
# cat > /etc/kubernetes/kubelet <<EOF KUBELET_OPTS="--logtostderr=true \ --v=4 --address=172.18.6.40 --hostname-override=172.18.6.40 --kubeconfig=/etc/kubernetes/kubeconfig.yaml --experimental-bootstrap-kubeconfig=/etc/kubernetes/bootstrap.kubeconfig --cert-dir=/etc/kubernetes/ssl --allow-privileged=true --cluster-dns=172.30.0.2 --cluster-domain=cluster.local --fail-swap-on=false --pod-infra-container-image=reg.baicm.com.cn/kubernetes/pause-amd64:3.1" EOF
3.生成kubelet配置文件
# cat > /etc/kubernetes/kubeconfig.yaml <<EOF apiVersion: v1 kind: Config users: - name: kubelet user: client-certificate: /etc/kubernetes/ssl/admin.pem client-key: /etc/kubernetes/ssl/admin-key.pem clusters: - name: local cluster: certificate-authority: /etc/kubernetes/ssl/ca.pem server: https://172.18.6.39:6443 #master contexts: - context: cluster: local user: kubelet name: my-context current-context: my-contextEOF
4.启动服务
# systemctl start kubelet # systemctl enable kubelet
二、配置kube-proxy
1.生成启动文件
cat <<EOF >/usr/lib/systemd/system/kube-proxy.service [Unit] Description=Kubernetes Proxy After=network.target [Service] EnvironmentFile=-/etc/kubernetes/kube-proxy ExecStart=/usr/bin/kube-proxy \$KUBE_PROXY_OPTS Restart=on-failure [Install] WantedBy=multi-user.target EOF
2.生成参数配置文件
# cat <<EOF >/etc/kubernetes/kube-proxy KUBE_PROXY_OPTS="--logtostderr=true \\ --v=4 \--hostname-override=172.18.6.40 \--kubeconfig=/etc/kubernetes/kube-proxy.kubeconfig" EOF
3.启动kube-proxy
# systemctl start kube-proxy # systemctl enable kube-proxy
原文地址:https://www.cnblogs.com/dingkailinux/p/9269736.html
时间: 2024-10-18 11:11:29