4、k8s node
#############kubelet
cp kubelet /usr/bin/
chmod 755 /usr/bin/kubelet
mkdir -p /app/kubernetes/data
mkdir -p /app/kubernetes/conf
mkdir -p /app/kubernetes/log
vi /usr/lib/systemd/system/kubelet.service
[Unit]
Description=Kubernetes Kubelet Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=docker.service
Requires=docker.service
[Service]
WorkingDirectory=/app/kubernetes/data
EnvironmentFile=/app/kubernetes/conf/kubelet
ExecStart=/usr/bin/kubelet $KUBELET_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
vi /app/kubernetes/conf/kubelet
KUBELET_ARGS="--kubeconfig=/app/kubernetes/conf/kubelet.kubeconfig --fail-swap-on=false --hostname-override=192.168.254.54 --pod-infra-container-image=mirrorgooglecontainers/pause-amd64:3.0 --logtostderr=false --log-dir=/app/kubernetes/log --v=2"
hostname-override=参数是指定名字,如果不写此参数默认是主机hostname名。
--pod-infra-container-image= 改写一个可下载镜像的地址,此image如果pull不了会导致分发无法创建pod
kubeconfig配置文件参考http://www.jianshu.com/p/41e55f4d0cb8
vi /app/kubernetes/conf/kubelet.kubeconfig
apiVersion: v1
kind: Config
clusters:
- cluster:
server: http://192.168.254.53:8080 #此处输入集群master地址
name: local
contexts: - context:
cluster: local
name: local
current-context: local
systemctl daemon-reload
systemctl enable kubelet.service
systemctl start kubelet.service
systemctl status kubelet.service
#############kube-proxy
cp kube-proxy /usr/bin/
chmod 755 /usr/bin/kube-proxy
vi /usr/lib/systemd/system/kube-proxy.service
[Unit]
Description=Kubernetes Kube-Proxy Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=network.target
Requires=network.service
[Service]
EnvironmentFile=/app/kubernetes/conf/proxy
ExecStart=/usr/bin/kube-proxy $KUBE_PROXY_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
vi /app/kubernetes/conf/proxy
KUBE_PROXY_ARGS="--master=http://192.168.254.53:8080 --logtostderr=false --log-dir=/app/kubernetes/log --v=2"#此处输入集群master地址
systemctl daemon-reload
systemctl enable kube-proxy.service
systemctl start kube-proxy.service
systemctl status kube-proxy.service
原文地址:http://blog.51cto.com/285534/2068962