跳至主要內容

k8s 问题集锦

Change Lee...大约 1 分钟容器k8s

The range of valid ports is 30000-32767

[root@master ~]# kubectl create -f tomcat-service.yaml 
The Service "webapp" is invalid: spec.ports[0].nodePort: Invalid value: 30000: provided port is already allocated

解决办法

编辑 kube-apiserver.yaml文件

vim /etc/kubernetes/manifests/kube-apiserver.yaml

找到 --service-cluster-ip-range 这一行,在这一行的下一行增加 如下内容

- --service-node-port-range=1-65535
file
file

最后 重启 kubelet

systemctl daemon-reload
systemctl restart kubelet

pod 不能跨node 访问

当前场景使用的flannel 网络,其他网络未测试

查看默kube-system 命名空间下的pod的ip地址

file
file

找一个在其他node的pod 进行ping 测试

file
file

发现网络不通
网络有解决办法,但是给的范围太在,所以对比了一下配置发现, FORWARD链默认是不转发的。

网络的解决办法open in new window

file
file

所以我们在所有Node上手动添加一条iptables 策略

#如果INPUT链默认也是DROP 也需要添加
iptables -A FORWARD -s 172.168.0.0/16 -j ACCEPT
#172.168.0.0/16  为cluster-cide
service iptables save
#如果命令不能执行,则安装一下 yum install iptables-services

配置完就可以Ping 通了

file
file

token 到期

报错
could not find a JWS signature in the cluster-info ConfigMap for token ID

参考链接open in new window

解决办法就是重新生成一个token

上次编辑于:
贡献者: change,lichangyangccm@163.com
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v3.1.3