189 8069 5689

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节点执行:

点击(此处)折叠或打开

  1. cd /etc/kubernetes

  2. 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状态

点击(此处)折叠或打开

  1. kubectl create clusterrolebinding kubelet-node-clusterbinding --clusterrole=system:node --user=system:node:10.116.82.28

  2.  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

点击(此处)折叠或打开

  1. [Unit]

  2. Description=Kubernetes Kubelet Server

  3. Documentation=http://kubernetes.io/docs/admin/kubelet/

  4. After=docker.service

  5. Requires=docker.service

  6. [Service]

  7. WorkingDirectory=/var/lib/kubelet

  8. EnvironmentFile=-/etc/kubernetes/config

  9. EnvironmentFile=-/etc/kubernetes/kubelet

  10. ExecStart=/usr/bin/kubelet \

  11.             $KUBE_LOGTOSTDERR \

  12.             $KUBE_LOG_LEVEL \

  13.             $KUBELET_API_SERVER \

  14.             $KUBELET_ADDRESS \

  15.             $KUBELET_PORT \

  16.             $KUBELET_HOSTNAME \

  17.             $KUBE_ALLOW_PRIV \

  18.             $KUBELET_POD_INFRA_CONTAINER \

  19.             $KUBELET_ARGS

  20. Restart=on-failure

  21. [Install]

  22. WantedBy=multi-user.target

kubelet配置文件

点击(此处)折叠或打开

  1. ## kubelet (minion) config

  2. #

  3. ## The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)

  4. KUBELET_ADDRESS="--address=10.116.82.28"

  5. #

  6. ## The port for the info server to serve on

  7. #KUBELET_PORT="--port=10250"

  8. #

  9. ## You may leave this blank to use the actual hostname

  10. KUBELET_HOSTNAME="--hostname-override=10.116.82.28"

  11. #

  12. ## location of the api-server

  13. #KUBELET_API_SERVER="--api-servers=http://10.116.137.196:8080"

  14. #

  15. ## pod infrastructure container

  16. #KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=sz-pg-oam-docker-hub-001.tendcloud.com/library/pod-infrastructure:rhel7"

  17. KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure"

  18. #

  19. ## Add your own!

  20. 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 请求.

kubernetes中怎么安装Node节点

通过 CSR 请求

kubectl certificate approve node-csr-nRoS_Xp89eNuqMmIQyE1SgllqjieGyYo5uMPtmhkfJ4

kubernetes中怎么安装Node节点

三: 安装Kube-proxy

1.yum install  conntrack-tools

2.service文件 vi /usr/lib/systemd/system/kube-proxy.service

点击(此处)折叠或打开

  1. [Unit]

  2. Description=Kubernetes Kube-Proxy Server

  3. Documentation=http://kubernetes.io/docs/admin/kube-proxy/

  4. After=network.target

  5. [Service]

  6. EnvironmentFile=-/etc/kubernetes/config

  7. EnvironmentFile=-/etc/kubernetes/proxy

  8. ExecStart=/usr/bin/kube-proxy \

  9.             $KUBE_LOGTOSTDERR \

  10.             $KUBE_LOG_LEVEL \

  11.             $KUBE_MASTER \

  12.             $KUBE_PROXY_ARGS

  13. Restart=on-failure

  14. LimitNOFILE=65536

  15. [Install]

  16. WantedBy=multi-user.target

3.配置文件  vi /etc/kubernetes/proxy

点击(此处)折叠或打开

  1. 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://jkwzsj.com/article/gjodpc.html

其他资讯