错误一:


[root@kmaster ~]# kubectl get node
The connection to the server 192.168.31.10:6443 was refused - did you specify the right host or port?

解决方法

错误二:

[root@master01 ~]#kubectl get namespace zhangpeng NAME STATUS AGE zhangpeng Terminating 15m [root@master01 ~]#

解决方法:

View resources that can be isolated using namespaces in the cluster. 查看集群中命名空间下隔离的资源 kubectl api-resources -o name --verbs=list --namespaced | xargs -n 1 kubectl get --show-kind --ignore-not-found -n zhangpeng

kubectl exec -it $(kubectl get pod -n jenkins | grep jenkins | head -1 | awk '{print $1}') -n jenkins /bin/bash

[root@k8s-master ~]# kubeadm init --kubernetes-version=v1.25.0 --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12 --ignore-preflight-errors=Swap
[init] Using Kubernetes version: v1.25.0
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR CRI]: container runtime is not running: output: E1006 22:31:17.405172    2233 remote_runtime.go:948] "Status from runtime service failed" err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
time="2022-10-06T22:31:17+08:00" level=fatal msg="getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
[root@k8s-master ~]#
[root@k8s-master containerd]# mv config.toml config.toml.bak
[root@k8s-master containerd]#  systemctl restart containerd
[root@k8s-master containerd]#
[root@k8s-master containerd]#

证书过期

[zhangpeng@27ops ~]$ kg no
Unable to connect to the server: x509: certificate has expired or is not yet valid: current time 2022-11-13T16:56:59+08:00 is after 2022-11-05T07:06:21Z
[zhangpeng@27ops ~]$ 

解决