node related component installation
docker installation
- Install the latest version of docker
wget -qO- https://get.docker.com/ | sh
kubelet installation
- Download the kubelet executable binary file and place it in the directory / opt/kubernetes/bin
- New directory / var/lib/kubelet
- Add kubelet.service file to / usr/lib/systemd/system/kubelet
[Unit]
Description=Kubernetes Kubelet Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=docker.service
Requires=docker.service
[Service]
WorkingDirectory=/var/lib/kubelet
EnvironmentFile=-/opt/kubernetes/cfg/config
EnvironmentFile=-/opt/kubernetes/cfg/kubelet
ExecStart=/opt/kubernetes/bin/kubelet \
$KUBE_LOGTOSTDERR \
$KUBE_LOG_LEVEL \
$KUBELET_API_SERVER \
$KUBELET_ADDRESS \
$KUBELET_PORT \
$KUBELET_HOSTNAME \
$KUBE_ALLOW_PRIV \
$KUBELET_POD_INFRA_CONTAINER \
$KUBELET_ARGS
Restart=on-failure
KillMode=process
[Install]
WantedBy=multi-user.target
Boot up
systemctl enable kubelet
Configure the / opt/kubernetes/kubelet configuration file.
###
# kubernetes kubelet (minion) config
# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
KUBELET_ADDRESS="--address=0.0.0.0"
# The port for the info server to serve on
# KUBELET_PORT="--port=10250"
# You may leave this blank to use the actual hostname
KUBELET_HOSTNAME="--hostname-override=172.16.66.173"
# pod infrastructure container
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=reg.docker.tb/harbor/pod-infrastructure:latest"
# Add your own!
KUBELET_ARGS="--enable-server=true --enable-debugging-handlers=true --fail-swap-on=false --kubeconfig=/var/lib/kubelet/kubeconfig"
Then add a configuration file, because 1.9.0 in kubelet no longer uses KUBELET_API_SERVER to communicate with API, but through another yaml configuration.
apiVersion: v1
kind: Config
users:
- name: kubelet
clusters:
- name: kubernetes
clusters:
server: http://172.16.66.172:8080
contexts:
- context:
cluster: kubernetes
user: kubelet
name: service-account-context
current-context: service-account-context
Kube proxy installation
- Download the Kube proxy binary file, directory location / opt / kubernetes / bin / Kube proxy
- Configure kube-proxy.service to / usr/lib/systemd/system/
[Unit]
Description=Kubernetes Kube-Proxy Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=network.target
[Service]
EnvironmentFile=-/opt/kubernetes/cfg/config
EnvironmentFile=-/opt/kubernetes/cfg/proxy
ExecStart=/opt/kubernetes/bin/kube-proxy \
$KUBE_LOGTOSTDERR \
$KUBE_LOG_LEVEL \
$KUBE_MASTER \
$KUBE_PROXY_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
- Boot up
systemctl enable kube-proxy
- To configure the / opt/kubernetes/proxy file, you must have
###
# kubernetes proxy config
# default config should be adequate
# Add your own!
KUBE_PROXY_ARGS=""