1、配置kubeletdocker
1.配置啓動文件bootstrap
# 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.target
EOF
2.配置kubelet參數文件api
# cat > /etc/kubernetes/kubelet <<EOF KUBELET_OPTS="--logtostderr=false \\ --v=4 \\
--log-dir=/opt/mflogs/kubelet \\
--root-dir=/opt/mfapps/kubernetes/kubelet/data \\
--address=0.0.0.0 \\ --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配置文件app
# 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-context
EOF
4.啓動服務dom
# systemctl start kubelet
# systemctl enable kubelet
2、配置kube-proxyui
1.生成啓動文件spa
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.生成參數配置文件code
# cat <<EOF >/etc/kubernetes/kube-proxy KUBE_PROXY_OPTS="--logtostderr=false \\ --v=4 \\ --log-dir=/opt/mflogs/kube-proxy--kubeconfig=/etc/kubernetes/kube-proxy.kubeconfig" EOF
3.啓動kube-proxyserver
# systemctl start kube-proxy
# systemctl enable kube-proxy