六、Kubernetes_V1.10集群部署-node-部署节点组件

一、配置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.target
EOF

2.配置kubelet参数文件

# 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配置文件

# 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.启动服务

# 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=false \
--v=4 \
--log-dir=/opt/mflogs/kube-proxy--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