|NO.Z.00034|——————————|^^ 部署 ^^|——|KuberNetes&二进制部署.V12|5台Server|---------------------------------
2022/3/29 14:26:25
本文主要是介绍|NO.Z.00034|——————————|^^ 部署 ^^|——|KuberNetes&二进制部署.V12|5台Server|---------------------------------,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
[CloudNative:KuberNetes&二进制部署.V12] [Applications.KuberNetes][|DevOps|k8s|**5节点**|二进制1.20|kubernetes-node组件配置|——|kubelet|kube-proxy|]
一、node节点组件配置
### --- 复制证书 ~~~ 从k8s-master01节点复制证书到node节点
### --- 进入证书目录下 [root@k8s-master01 bootstrap]# cd /etc/kubernetes/
### --- 将需要的证书复制到node节点下 [root@k8s-master01 kubernetes]# for NODE in k8s-master02 k8s-master03 k8s-node01 k8s-node02; do ssh $NODE mkdir -p /etc/kubernetes/pki /etc/etcd/ssl /etc/etcd/ssl for FILE in etcd-ca.pem etcd.pem etcd-key.pem; do scp /etc/etcd/ssl/$FILE $NODE:/etc/etcd/ssl/ done for FILE in pki/ca.pem pki/ca-key.pem pki/front-proxy-ca.pem bootstrap-kubelet.kubeconfig; do scp /etc/kubernetes/$FILE $NODE:/etc/kubernetes/${FILE} done done ~~~ 注:输出结果: etcd-ca.pem 100% 1367 31.4KB/s 00:00 etcd.pem 100% 1509 767.7KB/s 00:00 etcd-key.pem 100% 1679 629.8KB/s 00:00 ca.pem 100% 1411 316.4KB/s 00:00 ca-key.pem 100% 1679 953.2KB/s 00:00 front-proxy-ca.pem 100% 1143 308.3KB/s 00:00 bootstrap-kubelet.kubeconfig 100% 2299 517.1KB/s 00:00 etcd-ca.pem 100% 1367 1.0MB/s 00:00 etcd.pem 100% 1509 886.9KB/s 00:00 etcd-key.pem 100% 1679 940.7KB/s 00:00 ca.pem 100% 1411 500.9KB/s 00:00 ca-key.pem 100% 1679 505.2KB/s 00:00 front-proxy-ca.pem 100% 1143 351.2KB/s 00:00 bootstrap-kubelet.kubeconfig二、kubelet配置
### --- 所有node节点创建配置需要目录 ~~~ # 创建node节点部署目录 [root@k8s-master01 kubernetes]# mkdir -p /var/lib/kubelet /var/log/kubernetes /etc/systemd/system/kubelet.service.d /etc/kubernetes/manifests/
### --- 所有node节点配置kubelet service ~~~ # 创建kubelet.service配置文件 [root@k8s-master01 ~]# vim /usr/lib/systemd/system/kubelet.service [Unit] Description=Kubernetes Kubelet Documentation=https://github.com/kubernetes/kubernetes After=docker.service Requires=docker.service [Service] ExecStart=/usr/local/bin/kubelet Restart=always StartLimitInterval=0 RestartSec=10 [Install] WantedBy=multi-user.target
### --- 所有节点10-kubelet.conf配置文件下配置kubelet.service参数 ~~~ # 所有节点10-kubelet.conf下配置kubelet.service参数 [root@k8s-master01 ~]# vim /etc/systemd/system/kubelet.service.d/10-kubelet.conf [Service] Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.kubeconfig --kubeconfig=/etc/kubernetes/kubelet.kubeconfig" Environment="KUBELET_SYSTEM_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin" Environment="KUBELET_CONFIG_ARGS=--config=/etc/kubernetes/kubelet-conf.yml --pod-infra-container-image=registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2" Environment="KUBELET_EXTRA_ARGS=--node-labels=node.kubernetes.io/node='' " ExecStart= ExecStart=/usr/local/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_SYSTEM_ARGS $KUBELET_EXTRA_ARGS
### --- 创建kubelet配置文件 ~~~ # 注意:如果更改了k8s的service网段,需要更改kubelet-conf.yml 的clusterDNS:配置, ~~~ # 改成k8s Service网段的第十个地址,比如10.96.0.10
~~~ # 创建kubelet.conf配置文件 [root@k8s-master01 bootstrap]# vim /etc/kubernetes/kubelet-conf.yml apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration address: 0.0.0.0 port: 10250 readOnlyPort: 10255 authentication: anonymous: enabled: false webhook: cacheTTL: 2m0s enabled: true x509: clientCAFile: /etc/kubernetes/pki/ca.pem authorization: mode: Webhook webhook: cacheAuthorizedTTL: 5m0s cacheUnauthorizedTTL: 30s cgroupDriver: systemd cgroupsPerQOS: true clusterDNS: - 10.96.0.10 clusterDomain: cluster.local containerLogMaxFiles: 5 containerLogMaxSize: 10Mi contentType: application/vnd.kubernetes.protobuf cpuCFSQuota: true cpuManagerPolicy: none cpuManagerReconcilePeriod: 10s enableControllerAttachDetach: true enableDebuggingHandlers: true enforceNodeAllocatable: - pods eventBurst: 10 eventRecordQPS: 5 evictionHard: imagefs.available: 15% memory.available: 100Mi nodefs.available: 10% nodefs.inodesFree: 5% evictionPressureTransitionPeriod: 5m0s failSwapOn: true fileCheckFrequency: 20s hairpinMode: promiscuous-bridge healthzBindAddress: 127.0.0.1 healthzPort: 10248 httpCheckFrequency: 20s imageGCHighThresholdPercent: 85 imageGCLowThresholdPercent: 80 imageMinimumGCAge: 2m0s iptablesDropBit: 15 iptablesMasqueradeBit: 14 kubeAPIBurst: 10 kubeAPIQPS: 5 makeIPTablesUtilChains: true maxOpenFiles: 1000000 maxPods: 110 nodeStatusUpdateFrequency: 10s oomScoreAdj: -999 podPidsLimit: -1 registryBurst: 10 registryPullQPS: 5 resolvConf: /etc/resolv.conf rotateCertificates: true runtimeRequestTimeout: 2m0s serializeImagePulls: true staticPodPath: /etc/kubernetes/manifests streamingConnectionIdleTimeout: 4h0m0s syncFrequency: 1m0s volumeStatsAggPeriod: 1m0s三、启动kubelet并查看日志
### --- 启动所有节点kubelet并设置开机自启动 ~~~ # 启动kubelet服务并设置开机自启动 [root@k8s-master01 ~]# systemctl daemon-reload [root@k8s-master01 ~]# systemctl enable --now kubelet Created symlink from /etc/systemd/system/multi-user.target.wants/kubelet.service to /usr/lib/systemd/system/kubelet.service. [root@k8s-master01 ~]# systemctl status kubelet
### --- 查看系统日志 ~~~ # 此时系统日志/var/log/messages ~~~ Unable to update cni config: no networks found in /etc/cni/net.d ~~~ 显示只有如下信息为正常四、查看集群状态
### --- 查看集群状态 [root@k8s-master01 ~]# kubectl get node NAME STATUS ROLES AGE VERSION k8s-master01 NotReady <none> 2m27s v1.20.0 k8s-master02 NotReady <none> 2m27s v1.20.0 k8s-master03 NotReady <none> 2m29s v1.20.0 k8s-node01 NotReady <none> 119s v1.20.0 k8s-node02 NotReady <none> 111s v1.20.0
===============================END===============================
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart ——W.S.Landor
来自为知笔记(Wiz)
这篇关于|NO.Z.00034|——————————|^^ 部署 ^^|——|KuberNetes&二进制部署.V12|5台Server|---------------------------------的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-15在Kubernetes (k8s) 中搭建三台 Nginx 服务器怎么实现?-icode9专业技术文章分享
- 2024-11-05基于Kubernetes的自定义AWS云平台搭建指南
- 2024-11-05基于Kubernetes Gateway API的现代流量管理方案
- 2024-11-05在Kubernetes上部署你的第一个应用:Nginx服务器
- 2024-11-05利用拓扑感知路由控制Kubernetes中的流量
- 2024-11-05Kubernetes中的层次命名空间:更灵活的资源管理方案
- 2024-11-055分钟上手 Kubernetes:精简实用的 Kubectl 命令速查宝典!
- 2024-10-30K8s 容器的定向调度与亲和性
- 2024-10-28云原生周刊:K8s未来三大发展方向 丨2024.10.28
- 2024-10-25亚马逊弹性Kubernetes服务(EKS)实战:轻松搭建Kubernetes平台