将之前k8s集群的一个node 重置后join到另外一个k8s集群中, apply之后pod报错
Get https://[xxx]:443/apis/crd.projectcalico.org/v1/clusterinformations/default: x509: cannot validate certificate for xxx because it doesn't contain any IP SANs
之前的k8s环境没有清理干净, 需要清理/etc/cni/net.d
, IPVS
以及 $HOME/.kube/config
, 可以将这些目录备份后删掉
rm -rf $HOME/.kube/config
rm -rf /etc/cni/net.d
ipvsadm --clear
环境清理干净后再重新join到新集群中就能正常apply了
base/deployment.yaml
文件的deployment
添加- --kubelet-insecure-tls
例如: containers:
- name: metrics-server
image: swr.cn-east-3.myhuaweicloud.com/hll-bigdata/metrics-server:v0.5.0
imagePullPolicy: IfNotPresent
args:
- --cert-dir=/tmp
- --secure-port=443
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
- --kubelet-use-node-status-port
- --metric-resolution=15s
- --kubelet-insecure-tls
cat ~/.kube/config
看下clusters配置的集群名称, 然后执行下面的命令设置跳过非安全的证书校验kubectl config set-cluster <集群名称> --insecure-skip-tls-verify=true
https://192.168.76.131:4430
私库地址为例,配置私库cat <<EOF > /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
"registry-mirrors": ["https://6kx4zyno.mirror.aliyuncs.com"],
"registry-mirrors": ["`https://192.168.76.131:4430"]
}
EOF
继续修改/usr/lib/systemd/system/docker.service
下面的ExecStart
# vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry https://192.168.76.131:4430
重启docker 服务systemctl daemon-reload
systemctl restart docker.service
1. https://www.csdn.net/tags/NtzaIg5sNzE3ODUtYmxvZwO0O0OO0O0O.html
2. https://developer.aliyun.com/article/793487
3. https://github.com/kubernetes/kops/issues/964
4. https://www.stanzhai.site/blog/post/stanzhai/使用kubectl连接k8s集群提示x509-certificate正式无效的问题
5. https://www.freesion.com/article/15091201620/