kubernetes中怎么安装Node节点-创新互联
今天就跟大家聊聊有关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节点有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联-成都网站建设公司行业资讯频道,感谢大家的支持。
网站标题:kubernetes中怎么安装Node节点-创新互联
网站链接:http://pwwzsj.com/article/dipddo.html