您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關kubernetes中怎么安裝Node節點,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
一:前言
1.Kubernetes版本1.8.5;node ip 10.116.82.28; 對于kuberentes1.8集群,必須關閉swap,否則kubelet啟動將失敗;修改 /etc/fstab 將,swap系統注釋掉。
2.kubelet 啟動時向 kube-apiserver 發送 TLS bootstrapping 請求,需要先將 bootstrap token ?件中的 kubelet-bootstrap ?戶賦予 system:nodebootstrappercluster ??(role), 然后 kubelet 才能有權限創建認證請求(certificate signing requests):
在master節點執行:
點擊(此處)折疊或打開
cd /etc/kubernetes
kubectl create clusterrolebinding kubelet-bootstrap --clusterrole=system:node-bootstrapper --user=kubelet-bootstrap
3. 1.8版本之前.開啟rbac后,apiserver默認綁定system:nodes組到system:node的clusterrole。v1.8之后,此綁定默認不存在,需要手工綁定,否則kubelet啟動后會報認證錯誤,使用kubectl get nodes查看無法成為Ready狀態
點擊(此處)折疊或打開
kubectl create clusterrolebinding kubelet-node-clusterbinding --clusterrole=system:node --user=system:node:10.116.82.28
kubectl describe clusterrolebindings kubelet-node-clusterbinding
多個node節點的話:
kubectl create clusterrolebinding kubelet-node-clusterbinding --clusterrole=system:node --group=system:nodes
二: 安裝Kubelet
service文件:/usr/lib/systemd/system/kubelet.service. 負責master節點中的config文件到/etc/kubernetes/config
點擊(此處)折疊或打開
[Unit]
Description=Kubernetes Kubelet Server
Documentation=http://kubernetes.io/docs/admin/kubelet/
After=docker.service
Requires=docker.service
[Service]
WorkingDirectory=/var/lib/kubelet
EnvironmentFile=-/etc/kubernetes/config
EnvironmentFile=-/etc/kubernetes/kubelet
ExecStart=/usr/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
[Install]
WantedBy=multi-user.target
kubelet配置文件
點擊(此處)折疊或打開
## 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=10.116.82.28"
#
## 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=10.116.82.28"
#
## location of the api-server
#KUBELET_API_SERVER="--api-servers=http://10.116.137.196:8080"
#
## pod infrastructure container
#KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=sz-pg-oam-docker-hub-001.tendcloud.com/library/pod-infrastructure:rhel7"
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure"
#
## Add your own!
KUBELET_ARGS="--cgroup-driver=systemd --cluster-dns=10.254.0.2 --experimental-bootstrap-kubeconfig=/etc/kubernetes/bootstrap.kubeconfig --kubeconfig=/etc/kubernetes/kubelet.kubeconfig --require-kubeconfig --cert-dir=/etc/kubernetes/ssl --cluster-domain=cluster.local. --hairpin-mode promiscuous-bridge --serialize-image-pulls=false --runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice"
啟動kubelet
systemctl daemon-reload
systemctl enable kubelet
systemctl start kubelet
systemctl status kubelet
通過 kublet 的 TLS 證書請求
kubelet ?次啟動時向 kube-apiserver 發送證書簽名請求,必須通過后kubernetes 系統才會將該 Node 加?到集群。查看未授權的 CSR 請求.
通過 CSR 請求
kubectl certificate approve node-csr-nRoS_Xp89eNuqMmIQyE1SgllqjieGyYo5uMPtmhkfJ4
三: 安裝Kube-proxy
1.yum install conntrack-tools
2.service文件 vi /usr/lib/systemd/system/kube-proxy.service
點擊(此處)折疊或打開
[Unit]
Description=Kubernetes Kube-Proxy Server
Documentation=http://kubernetes.io/docs/admin/kube-proxy/
After=network.target
[Service]
EnvironmentFile=-/etc/kubernetes/config
EnvironmentFile=-/etc/kubernetes/proxy
ExecStart=/usr/bin/kube-proxy \
$KUBE_LOGTOSTDERR \
$KUBE_LOG_LEVEL \
$KUBE_MASTER \
$KUBE_PROXY_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
3.配置文件 vi /etc/kubernetes/proxy
點擊(此處)折疊或打開
KUBE_PROXY_ARGS="--bind-address=10.116.82.28 --hostname-override=10.116.82.28 --kubeconfig=/etc/kubernetes/kube-proxy.kubeconfig --cluster-cidr=10.254.0.0/16"
4.啟動
systemctl daemon-reload
systemctl enable kube-proxy
systemctl start kube-proxy
systemctl status kube-proxy
看完上述內容,你們對kubernetes中怎么安裝Node節點有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。