您现在的位置是: 网站首页 >Kubernetes >Docker&Kubernetes技术全解 Kubernetes

【K8s+Docker技术全解】12.Node运算节点服务-部署kube-proxy

admin2020年10月19日 23:06 Docker | Kubernetes | Linux 932人已围观

Docker&Kubernetes技术全解简介 Kubernetes 是一个可移植的、可扩展的开源平台,用于管理容器化的工作负载和服务,可促进声明式配置和自动化。Kubernetes 拥有一个庞大且快速增长的生态系统。Kubernetes 的服务、支持和工具广泛可用。 课程来自老男孩教育学习总结。

## 99.151/152部署kube-proxy ### 什么是kube-proxy? kube-proxy 是集群中每个节点上运行的网络代理,是实现service资源功能组件之一。kube-proxy 建立了pod网络和集群网络之间的关系,即 cluster ip 和 pod ip 中间的关系。不同Node上的service流量转发规则会通过kube-proxy进行更新,其实是调用apiserver访问etcd进行规则更新。 service流量调度方式有三种方式: userspace(废弃,性能很差)、iptables(性能差,复杂)、ipvs(性能好,转发方式清晰)。 主要用途是连接pod网络和集群网络,需要kube-proxy的服务 ### 运维主机签发kube-proxy证书 #### 创建生成证书签名请求(csr)的json配置文件 ```bash # 192.168.99.200 [root@k8s99-200 ~]# cd /opt/certs/ [root@k8s99-200 certs]# vim kube-proxy-csr.json ``` 内容如下 ```json { "CN": "system:kube-proxy", "key": { "algo": "rsa", "size": 2048 }, "names": [ { "C": "CN", "ST": "sichuan", "L": "chengdu", "O": "study", "OU": "ops" } ] } ``` 注意`"CN": "system:kube-proxy"`中的值不能改,`CN`对应的是k8s默认的`kube-proxy`角色。如果不将`CN`签成k8s里面角色名称,像kubelet中的用法,前面的`system:node`也是k8s默认的角色;否则就需要做角色绑定ClusterRoleBinding。 这样签发证书,就是让kube-proxy这个用户默认拥有了k8s里`system:kube-proxy`这个默认的角色。 #### 生成kubelet证书和私钥 ```bash # 192.168.99.200 [root@k8s99-200 certs]# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client kube-proxy-csr.json | cfssljson -bare kube-proxy-client # 查看签发的证书,到目前已经签发了6套证书,已经是最少的签发次数了 [root@k8s99-200 certs]# ll | grep kube-proxy-client -rw-r--r--. 1 root root 1009 6月 24 20:59 kube-proxy-client.csr -rw-------. 1 root root 1675 6月 24 20:59 kube-proxy-client-key.pem -rw-r--r--. 1 root root 1399 6月 24 20:59 kube-proxy-client.pem ``` ### 99.151部署kube-proxy #### 从运维主机上拷贝证书到certs ```bash # 进入Kubernetes中certs目录 [root@k8s99-151 ~]# cd /opt/kubernetes/server/bin/certs/ # 拷贝运维主机生成的kube-proxy证书 [root@k8s99-151 certs]# scp k8s99-200:/opt/certs/kube-proxy-client.pem . [root@k8s99-151 certs]# scp k8s99-200:/opt/certs/kube-proxy-client-key.pem . [root@k8s99-151 certs]# ll | grep kube-proxy -rw-------. 1 root root 1675 6月 24 21:00 kube-proxy-client-key.pem -rw-r--r--. 1 root root 1399 6月 24 21:00 kube-proxy-client.pem ``` #### 创建配置 创建的`kube-proxy.kubeconfig`就是`kube-proxy`用户的配置文件 ##### set-cluster ```bash # 进入conf目录 [root@k8s99-151 certs]# cd ../conf/ [root@k8s99-151 conf]# pwd /opt/kubernetes/server/bin/conf [root@k8s99-151 conf]# kubectl config set-cluster myk8s \ --certificate-authority=/opt/kubernetes/server/bin/certs/ca.pem \ --embed-certs=true \ --server=https://192.168.99.100:7443 \ --kubeconfig=kube-proxy.kubeconfig Cluster "myk8s" set. ``` ##### set-credentials ```bash [root@k8s99-151 conf]# kubectl config set-credentials kube-proxy \ --client-certificate=/opt/kubernetes/server/bin/certs/kube-proxy-client.pem \ --client-key=/opt/kubernetes/server/bin/certs/kube-proxy-client-key.pem \ --embed-certs=true \ --kubeconfig=kube-proxy.kubeconfig User "kube-proxy" set. ``` ##### set-context ```bash [root@k8s99-151 conf]# kubectl config set-context myk8s_context \ --cluster=myk8s \ --user=kube-proxy \ --kubeconfig=kube-proxy.kubeconfig Context "myk8s_context" created. ``` ##### use-context ```bash [root@k8s99-151 conf]# kubectl config use-context myk8s_context \ --kubeconfig=kube-proxy.kubeconfig Switched to context "myk8s_context". ``` #### 创建kube-proxy启动脚本 ##### 加载ipvs模块 `lsmod`即`list modules`,是一个小程序,用来显示文件、`proc/modules`的信息,也就是显示当前内核模块装载的模块。 执行`lsmod`指令,会列出所有已载入系统的模块。Linux操作系统的核心具有模块化的特性,应此在编译核心时,务须把全部的功能都放入核心。可以将这些功能编译成一个个单独的模块,待需要时再分别载入。 进入根目录 ```bash [root@k8s99-151 conf]# cd [root@k8s99-151 ~]# pwd /root [root@k8s99-151 ~]# lsmod | grep ip_vs # 目前是没有关于 ip_vs 相关模块的 ``` 添加脚本 ```bash [root@k8s99-151 ~]# vim /root/ipvs.sh # 添加下面的内容 #!/bin/bash ipvs_mods_dir="/usr/lib/modules/$(uname -r)/kernel/net/netfilter/ipvs" for i in $(ls $ipvs_mods_dir | grep -o "^[^.]*") do /sbin/modinfo -F filename $i &> /dev/null if [ $? -eq 0 ];then /sbin/modprobe $i fi done ``` 添加执行权限并执行 ```bash [root@k8s99-151 ~]# chmod +x ipvs.sh [root@k8s99-151 ~]# ./ipvs.sh [root@k8s99-151 ~]# lsmod | grep ip_vs ip_vs_wrr 12697 0 ip_vs_wlc 12519 0 ip_vs_sh 12688 0 ip_vs_sed 12519 0 ip_vs_rr 12600 0 ip_vs_pe_sip 12740 0 nf_conntrack_sip 33780 1 ip_vs_pe_sip ip_vs_nq 12516 0 ip_vs_lc 12516 0 ip_vs_lblcr 12922 0 ip_vs_lblc 12819 0 ip_vs_ftp 13079 0 ip_vs_dh 12688 0 ip_vs 145497 24 ip_vs_dh,ip_vs_lc,ip_vs_nq,ip_vs_rr,ip_vs_sh,ip_vs_ftp,ip_vs_sed,ip_vs_wlc,ip_vs_wrr,ip_vs_pe_sip,ip_vs_lblcr,ip_vs_lblc nf_nat 26583 4 ip_vs_ftp,nf_nat_ipv4,nf_nat_ipv6,nf_nat_masquerade_ipv4 nf_conntrack 139224 10 ip_vs,nf_nat,nf_nat_ipv4,nf_nat_ipv6,xt_conntrack,nf_nat_masquerade_ipv4,nf_conntrack_netlink,nf_conntrack_sip,nf_conntrack_ipv4,nf_conntrack_ipv6 libcrc32c 12644 4 xfs,ip_vs,nf_nat,nf_conntrack # 就把ipvs的相关模块加载进来了,然后kube-proxy就可以调用这些模块 ``` ipvs中实现的10种连接调度算法 - 轮循调度(Round-Robin Scheduling):rr(静态算法) > 调度器通过”轮询”调度算法将外部请求按顺序轮流分配到集群中的真实服务器上,它均等地对待每一台服务器,而不管服务器上实际的连接数和系统负载。 - 加权轮循调度(Weighted Round-Robin Scheduling):wrr(静态算法) > 调度器通过”加权轮询”调度算法根据真实服务器的不同处理能力来调度访问请求。这样可以保证处理能力强的服务器处理更多的访问流量。调度器可以自动问询真实服务器的负载情况,并动态地调整其权值。 - 最小连接调度(Least-Connection Scheduling):lc(动态算法) > 当有新的作业到达时,调度器选择一个当前作业量较少的真实服务器,并把新到达的作业分配给它。如果集群系统的真实服务器具有相近的系统性能,采用”最小连接”调度算法可以较好地均衡负载。 - 加权最小连接调度(Weighted Least-Connection Scheduling):wlc(动态算法) > 将更多的作业分配给作业较少且相对于权重较高(Ci / Wi)的服务器。这是默认值。 > 在集群系统中的服务器性能差异较大的情况下,调度器采用”加权最少链接”调度算法优化负载均衡性能,具有较高权值的服务器将承受较大比例的活动连接负载。调度器可以自动问询真实服务器的负载情况,并动态地调整其权值。 - 基于局部性的最少链接(Locality-Based Least Connections Scheduling):lblc(动态算法) > 该算法根据请求的目标IP地址找出该目标IP地址最近使用的服务器,若该服务器 是可用的且没有超载,将请求发送到该服务器;若服务器不存在,或者该服务器超载且有服务器处于一半的工作负载,则用”最少链接”的原则选出一个可用的服务器,将请求发送到该服务器。 - 带复制的基于局部性最少链接(Locality-Based Least Connections with Replication Scheduling):lblcr(动态算法) > 它与LBLC算法的不同之处是它要维护从一个目标IP地址到一组服务器的映射,而LBLC算法维护从一个目标IP地址到一台服务器的映射。该算法根据请求的目标IP地址找出该目标IP地址对应的服务器组,按”最小连接”原则从服务器组中选出一台服务器,若服务器没有超载,将请求发送到该服务器,若服务器超载;则按”最小连接”原则从这个集群中选出一 台服务器,将该服务器加入到服务器组中,将请求发送到该服务器。同时,当该服务器组有一段时间没有被修改,将最忙的服务器从服务器组中删除,以降低复制的程度。 - 目标地址散列调度(Destination Hashing Scheduling):dh(静态算法) > 调度算法根据请求的目标IP地址,作为散列键(Hash Key)从静态分配的散列表找出对应的服务器,若该服务器是可用的且未超载,将请求发送到该服务器。 - 源地址散列调度(Source Hashing Scheduling):sh(静态算法) > 调度算法根据请求的源IP地址,作为散列键(Hash Key)从静态分配的散列表找出对应的服务器,若该服务器是可用的且未超载,将请求发送到该服务器。 - 最短预期延时调度(Shortest Expected Delay Scheduling):sed(动态算法) > 将预计延迟最短的传入作业分配给服务器。如果发送到第i个服务器,则作业将经历的预期延迟是(C i + 1)/ U i,其中C i是第i个服务器上的作业数量,并且U i是第i个服务器的固定服务速率。 - 不排队调度(Never Queue Scheduling):nq(动态算法) > 如果有进来的作业,则分配一个空闲的服务器,而不是等待一个快速的服务器; 如果所有服务器都忙,则采用最短期望延迟策略分配作业。 ##### 创建启动脚本 ```bash [root@k8s99-151 ~]# cd /opt/kubernetes/server/bin/ [root@k8s99-151 bin]# vim kube-proxy-startup.sh # 添加下面内容 #!/bin/bash ./kube-proxy \ --cluster-cidr 172.99.0.0/16 \ --hostname-override k8s99-151.host.com \ --proxy-mode=ipvs \ --ipvs-scheduler=nq \ --kubeconfig ./conf/kube-proxy.kubeconfig # 添加执行权限 [root@k8s99-151 bin]# chmod +x kube-proxy-startup.sh [root@k8s99-151 bin]# ./kube-proxy-startup.sh # 运行报错 624 21:06:20.219997 3939 node.go:125] Failed to retrieve node info: nodes "k8s99-151.host.com" is forbidden: User "system:anonymous" cannot get resource "nodes" in API group "" at the cluster scope E0624 21:06:28.369854 3939 node.go:125] Failed to retrieve node info: nodes "k8s99-151.host.com" is forbidden: User "system:anonymous" cannot get resource "nodes" in API group "" at the cluster scope # 这个问题是因为 kube-proxy.kubeconfig 配置中user写错,注意检查,修复后又出现下方错误 E0624 21:19:39.692487 6735 proxier.go:1950] Failed to list IPVS destinations, error: parseIP Error ip=[192 168 99 152 0 0 0 0 0 0 0 0 0 0 0 0] E0624 21:19:39.692517 6735 proxier.go:1192] Failed to sync endpoint for service: 192.168.0.1:443/TCP, err: parseIP Error ip=[192 168 99 152 0 0 0 0 0 0 0 0 0 0 0 0] ``` ##### 升级内核解决Failed to list IPVS destinations, error 参考 https://blog.csdn.net/networken/article/details/105604173 根据关键字 IPVS、parseIP Error 可知,可能是由于 IPVS 模块对 IP 进行格式化导致出现问题。 因为这个问题是升级到 kubernetes 1.18 版本才出现的(查阅到1.17没问题),所以去 Kubernetes Github 查看相关 issues,发现有人在升级 Kubernetes 版本到 1.18 后,也遇见了相同的问题,经过 issue 中 Kubernetes 维护人员讨论,分析出原因可能为新版 Kubernetes 使用的 IPVS 模块是比较新的,需要系统内核版本支持,本人使用的是 CentOS 系统,内核版本为 3.10,里面的 IPVS 模块比较老旧,缺少新版 Kubernetes IPVS 所需的依赖。 根据该 issue 讨论结果,解决该问题的办法是,更新内核为新的版本。 注:该 issues 地址为 [https://github.com/kubernetes/kubernetes/issues/89520](https://github.com/kubernetes/kubernetes/issues/89520) 升级内核步骤如下: ```bash # 查看当前内核版本 [root@k8s99-151 bin]# uname -r 3.10.0-1062.4.1.el7.x86_64 # 载入公钥 [root@k8s99-151 bin]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org # 安装 ELRepo 最新版本 [root@k8s99-151 bin]# yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm # 列出可以使用的 kernel 包版本 [root@k8s99-151 bin]# yum list available --disablerepo=* --enablerepo=elrepo-kernel 可安装的软件包 kernel-lt.x86_64 4.4.228-2.el7.elrepo elrepo-kernel kernel-lt-devel.x86_64 4.4.228-2.el7.elrepo elrepo-kernel kernel-lt-doc.noarch 4.4.228-2.el7.elrepo elrepo-kernel kernel-lt-headers.x86_64 4.4.228-2.el7.elrepo elrepo-kernel kernel-lt-tools.x86_64 4.4.228-2.el7.elrepo elrepo-kernel kernel-lt-tools-libs.x86_64 4.4.228-2.el7.elrepo elrepo-kernel kernel-lt-tools-libs-devel.x86_64 4.4.228-2.el7.elrepo elrepo-kernel kernel-ml.x86_64 5.7.4-1.el7.elrepo elrepo-kernel kernel-ml-devel.x86_64 5.7.4-1.el7.elrepo elrepo-kernel kernel-ml-doc.noarch 5.7.4-1.el7.elrepo elrepo-kernel kernel-ml-headers.x86_64 5.7.4-1.el7.elrepo elrepo-kernel kernel-ml-tools.x86_64 5.7.4-1.el7.elrepo elrepo-kernel kernel-ml-tools-libs.x86_64 5.7.4-1.el7.elrepo elrepo-kernel kernel-ml-tools-libs-devel.x86_64 5.7.4-1.el7.elrepo elrepo-kernel perf.x86_64 5.7.4-1.el7.elrepo elrepo-kernel python-perf.x86_64 5.7.4-1.el7.elrepo elrepo-kernel # 安装指定的 kernel 版本 [root@k8s99-151 bin]# yum install -y kernel-lt-4.4.228-2.el7.elrepo --enablerepo=elrepo-kernel 已安装: kernel-lt.x86_64 0:4.4.228-2.el7.elrepo 完毕! # 查看系统可用内核 [root@k8s99-151 bin]# cat /boot/grub2/grub.cfg | grep menuentry if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" menuentry_id_option="" export menuentry_id_option menuentry 'CentOS Linux (4.4.228-2.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-905691b3-5cee-4b70-8ba9-c22372722b49' { menuentry 'CentOS Linux (3.10.0-1062.4.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-905691b3-5cee-4b70-8ba9-c22372722b49' { menuentry 'CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-905691b3-5cee-4b70-8ba9-c22372722b49' { menuentry 'CentOS Linux (0-rescue-2077e1e89c0c4c88a283116e73086bd0) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-2077e1e89c0c4c88a283116e73086bd0-advanced-905691b3-5cee-4b70-8ba9-c22372722b49' { # 设置开机从新内核启动 [root@k8s99-151 bin]# grub2-set-default "CentOS Linux (4.4.228-2.el7.elrepo.x86_64) 7 (Core)" # 查看内核启动项 [root@k8s99-151 bin]# grub2-editenv list saved_entry=CentOS Linux (4.4.228-2.el7.elrepo.x86_64) 7 (Core) # 重启系统使内核生效 [root@k8s99-151 bin]# reboot # 启动完成查看内核版本是否更新 [root@k8s99-151 ~]# uname -r 4.4.228-2.el7.elrepo.x86_64 ``` 创建需要用到的目录 ```bash [root@k8s99-151 bin]# mkdir /var/log/kube-proxy ``` #### 使用supervisor启动kube-proxy.ini ```bash [root@k8s99-151 bin]# vim /etc/supervisord.d/kube-proxy.ini ``` 写入下面配置 ```ini [program:kube-proxy-k8s99-151] command=/opt/kubernetes/server/bin/kube-proxy-startup.sh numprocs=1 directory=/opt/kubernetes/server/bin/ autostart=true autorestart=true startsecs=30 startretries=3 exitcodes=0,2 stopsignal=QUIT stopwaitsecs=10 user=root redirect_stderr=true stdout_logfile=/var/log/kube-proxy/kube-proxy.stdout.log stdout_logfile_maxbytes=64MB stdout_logfile_backups=4 stdout_capture_maxbytes=1MB stdout_events_enabled=false ``` ```bash [root@k8s99-151 bin]# supervisorctl update kube-proxy-k8s99-151: added process group [root@k8s99-151 bin]# supervisorctl status etcd-server-k8s99-151 RUNNING pid 1373, uptime 0:28:44 kube-apiserver-k8s99-151 RUNNING pid 1368, uptime 0:28:44 kube-controller-manager-k8s99-151 RUNNING pid 1369, uptime 0:28:44 kube-proxy-k8s99-151 RUNNING pid 7455, uptime 0:01:49 kube-scheduler-k8s99-151 RUNNING pid 1372, uptime 0:28:44 kubelet-k8s99-151 RUNNING pid 1370, uptime 0:28:44 ``` 启动后查看日志 ```bash [root@k8s99-151 ~]# tail -f /var/log/kube-proxy/kube-proxy.stdout.log I0624 22:50:39.824296 1927 node.go:136] Successfully retrieved node IP: 192.168.99.151 I0624 22:50:39.824323 1927 server_others.go:259] Using ipvs Proxier. I0624 22:50:39.832264 1927 server.go:583] Version: v1.18.2 I0624 22:50:39.834804 1927 conntrack.go:52] Setting nf_conntrack_max to 131072 I0624 22:50:39.835411 1927 config.go:315] Starting service config controller I0624 22:50:39.835419 1927 shared_informer.go:223] Waiting for caches to sync for service config I0624 22:50:39.835429 1927 config.go:133] Starting endpoints config controller I0624 22:50:39.835479 1927 shared_informer.go:223] Waiting for caches to sync for endpoints config I0624 22:50:39.944456 1927 shared_informer.go:230] Caches are synced for service config I0624 22:50:39.944501 1927 shared_informer.go:230] Caches are synced for endpoints config ``` 启动完成后,使用`ipvsadm`查看状态 ```bash [root@k8s99-151 bin]# yum install ipvsadm [root@k8s99-151 bin]# ipvsadm -Ln IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.0.1:443 nq -> 192.168.99.151:6443 Masq 1 0 0 -> 192.168.99.152:6443 Masq 1 0 0 # 可以看到已经将192.168.0.1:443 反代到了了192.168.99.151:6443和152:6443,及apiserver的服务 [root@k8s99-151 bin]# kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 192.168.0.1 <none> 443/TCP 22d ``` #### 检查kube-proxy端口监听 ```bash [root@k8s99-151 bin]# netstat -luntp | grep kube-proxy tcp 0 0 127.0.0.1:10249 0.0.0.0:* LISTEN 7456/./kube-proxy tcp6 0 0 :::10256 :::* LISTEN 7456/./kube-proxy ``` #### 防火墙允许对外端口 ```bash [root@k8s99-151 bin]# firewall-cmd --zone=public --add-port=10256/tcp --permanent success [root@k8s99-151 bin]# firewall-cmd --reload success ``` ### 99.152部署kube-proxy ```bash # 拷贝证书到本机 [root@k8s99-152 ~]# cd /opt/kubernetes/server/bin/certs/ [root@k8s99-152 certs]# scp k8s99-200:/opt/certs/kube-proxy-client.pem . [root@k8s99-152 certs]# scp k8s99-200:/opt/certs/kube-proxy-client-key.pem . # 拷贝kube-proxy.kubeconfig配置到本机 [root@k8s99-152 certs]# cd ../conf/ [root@k8s99-152 conf]# scp k8s99-151:/opt/kubernetes/server/bin/conf/kube-proxy.kubeconfig . # 拷贝ipvs脚本到本地 [root@k8s99-152 conf]# scp k8s99-151:/root/ipvs.sh /root/ [root@k8s99-152 conf]# chmod +x /root/ipvs.sh [root@k8s99-152 conf]# /root/ipvs.sh [root@k8s99-152 conf]# lsmod | grep ip_vs # ... # 创建启动脚本 [root@k8s99-152 conf]# cd .. [root@k8s99-152 bin]# vim kube-proxy-startup.sh # 添加下面内容 #!/bin/bash ./kube-proxy \ --cluster-cidr 172.99.0.0/16 \ --hostname-override k8s99-152.host.com \ --proxy-mode=ipvs \ --ipvs-scheduler=nq \ --kubeconfig ./conf/kube-proxy.kubeconfig # 添加执行权限 [root@k8s99-152 bin]# chmod +x kube-proxy-startup.sh # 升级内核 [root@k8s99-152 bin]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org [root@k8s99-152 bin]# yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm [root@k8s99-152 bin]# yum install -y kernel-lt-4.4.228-2.el7.elrepo --enablerepo=elrepo-kernel [root@k8s99-152 bin]# grub2-set-default "CentOS Linux (4.4.228-2.el7.elrepo.x86_64) 7 (Core)" [root@k8s99-152 bin]# reboot [root@k8s99-152 bin]# uname -r # 执行程序 [root@k8s99-152 bin]# ./kube-proxy-startup.sh # 创建需要的目录 [root@k8s99-152 bin]# mkdir /var/log/kube-proxy # 使用supervisor启动kube-proxy [root@k8s99-152 bin]# vim /etc/supervisord.d/kube-proxy.ini [program:kube-proxy-k8s99-152] command=/opt/kubernetes/server/bin/kube-proxy-startup.sh numprocs=1 directory=/opt/kubernetes/server/bin/ autostart=true autorestart=true startsecs=30 startretries=3 exitcodes=0,2 stopsignal=QUIT stopwaitsecs=10 user=root redirect_stderr=true stdout_logfile=/var/log/kube-proxy/kube-proxy.stdout.log stdout_logfile_maxbytes=64MB stdout_logfile_backups=4 stdout_capture_maxbytes=1MB stdout_events_enabled=false # 启动查看状态 [root@k8s99-152 bin]# supervisorctl update [root@k8s99-152 bin]# supervisorctl status # 防火墙允许端口 [root@k8s99-152 bin]# netstat -luntp | grep kube-proxy tcp 0 0 127.0.0.1:10249 0.0.0.0:* LISTEN 10193/./kube-proxy tcp6 0 0 :::10256 :::* LISTEN 10193/./kube-proxy [root@k8s99-151 bin]# firewall-cmd --zone=public --add-port=10256/tcp --permanent success [root@k8s99-151 bin]# firewall-cmd --reload success ```

很赞哦! (0)

文章交流

  • emoji
0人参与,0条评论

当前用户

未登录,点击   登录

站点信息

  • 建站时间:网站已运行2074天
  • 系统信息:Linux
  • 后台程序:Python: 3.8.10
  • 网站框架:Django: 3.2.6
  • 文章统计:256 篇
  • 文章评论:60 条
  • 腾讯分析网站概况-腾讯分析
  • 百度统计网站概况-百度统计
  • 公众号:微信扫描二维码,关注我们
  • QQ群:QQ加群,下载网站的学习源码
返回
顶部
标题 换行 登录
网站