k8s init:Get http://localhost:10248/healthz: dial tcp 127.0.0.1:10248: connect: connection


这是我的报错信息
卡在这里了!
网上方法全试了

tim@master-node:~$ sudo kubeadm init --image-repository="registry.cn-hangzhou.aliyuncs.com/google_containers" --pod-network-cidr=10.244.0.0/16  --ignore-preflight-errors=SystemVerification --ignore-preflight-errors=Mem --upload-certs
[init] Using Kubernetes version: v1.26.0
[preflight] Running pre-flight checks
        [WARNING Hostname]: hostname "master-node" could not be reached
        [WARNING Hostname]: hostname "master-node": lookup master-node on 192.168.1.1:53: no such host
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local master-node] and IPs [10.96.0.1 192.168.1.16]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [localhost master-node] and IPs [192.168.1.16 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [localhost master-node] and IPs [192.168.1.16 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.

Unfortunately, an error has occurred:
        timed out waiting for the condition

This error is likely caused by:
        - The kubelet is not running
        - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)

If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
        - 'systemctl status kubelet'
        - 'journalctl -xeu kubelet'

Additionally, a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI.
Here is one example how you may list all running Kubernetes containers by using crictl:
        - 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock ps -a | grep kube | grep -v pause'
        Once you have found the failing container, you can inspect its logs with:
        - 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock logs CONTAINERID'
error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster
To see the stack trace of this error execute with --v=5 or higher

这个服务似乎起不来

图片

日志

tim@master-node:~$ sudo journalctl -u kubelet
-- Journal begins at Fri 2023-01-06 17:39:24 CST, ends at Fri 2023-01-06 20:09:17 CST. --
1月 06 17:39:24 master-node systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
1月 06 17:39:24 master-node systemd[1]: Started kubelet: The Kubernetes Node Agent.
1月 06 17:39:25 master-node kubelet[4307]: Flag --pod-infra-container-image has been deprecated, will be removed in 1.27. Image garbage collector will get sandbox image information from CRI.
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.092168    4307 server.go:198] "--pod-infra-container-image will not be pruned by the image garbage collector in kubelet and should also be set in the remote runtime"
1月 06 17:39:25 master-node kubelet[4307]: Flag --pod-infra-container-image has been deprecated, will be removed in 1.27. Image garbage collector will get sandbox image information from CRI.
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.109868    4307 server.go:412] "Kubelet version" kubeletVersion="v1.26.0"
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.109961    4307 server.go:414] "Golang settings" GOGC="" GOMAXPROCS="" GOTRACEBACK=""
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.110831    4307 server.go:836] "Client rotation is on, will bootstrap in background"
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.117100    4307 certificate_store.go:130] Loading cert/key pair from "/var/lib/kubelet/pki/kubelet-client-current.pem".
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.120194    4307 dynamic_cafile_content.go:157] "Starting controller" name="client-ca-bundle::/etc/kubernetes/pki/ca.crt"
1月 06 17:39:25 master-node kubelet[4307]: W0106 17:39:25.125648    4307 sysinfo.go:203] Nodes topology is not available, providing CPU topology
1月 06 17:39:25 master-node kubelet[4307]: W0106 17:39:25.127593    4307 machine.go:65] Cannot read vendor id correctly, set empty.
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.130562    4307 server.go:659] "--cgroups-per-qos enabled, but --cgroup-root was not specified.  defaulting to /"
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.131429    4307 container_manager_linux.go:267] "Container manager verified user specified cgroup-root exists" cgroupRoot=[]
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.131737    4307 container_manager_linux.go:272] "Creating Container Manager object based on Node Config" nodeConfig={RuntimeCgroupsName: SystemCgroupsName: KubeletCgroupsName: Ku>
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.131857    4307 topology_manager.go:134] "Creating topology manager with policy per scope" topologyPolicyName="none" topologyScopeName="container"
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.131911    4307 container_manager_linux.go:308] "Creating device plugin manager"
1月 06 17:39:25 master-node kubelet[4307]: I0106 17:39:25.132067    4307 state_mem.go:36] "Initialized new in-memory state store"
1月 06 17:39:25 master-node kubelet[4307]: E0106 17:39:25.138378    4307 run.go:74] "command failed" err="failed to run Kubelet: validate service connection: CRI v1 runtime API is not implemented for endpoint \"unix:///var/run/containe>
1月 06 17:39:25 master-node systemd[1]: kubelet.service: Main process exited, code=exited, status=1/FAILURE
1月 06 17:39:25 master-node systemd[1]: kubelet.service: Failed with result 'exit-code'.
1月 06 17:39:35 master-node systemd[1]: kubelet.service: Scheduled restart job, restart counter is at 136.
1月 06 17:39:35 master-node systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
1月 06 17:39:35 master-node systemd[1]: Started kubelet: The Kubernetes Node Agent.
1月 06 17:39:35 master-node kubelet[4317]: Flag --pod-infra-container-image has been deprecated, will be removed in 1.27. Image garbage collector will get sandbox image information from CRI.
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.590686    4317 server.go:198] "--pod-infra-container-image will not be pruned by the image garbage collector in kubelet and should also be set in the remote runtime"
1月 06 17:39:35 master-node kubelet[4317]: Flag --pod-infra-container-image has been deprecated, will be removed in 1.27. Image garbage collector will get sandbox image information from CRI.
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.603222    4317 server.go:412] "Kubelet version" kubeletVersion="v1.26.0"
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.603320    4317 server.go:414] "Golang settings" GOGC="" GOMAXPROCS="" GOTRACEBACK=""
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.604347    4317 server.go:836] "Client rotation is on, will bootstrap in background"
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.613215    4317 certificate_store.go:130] Loading cert/key pair from "/var/lib/kubelet/pki/kubelet-client-current.pem".
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.618116    4317 dynamic_cafile_content.go:157] "Starting controller" name="client-ca-bundle::/etc/kubernetes/pki/ca.crt"
1月 06 17:39:35 master-node kubelet[4317]: W0106 17:39:35.623228    4317 sysinfo.go:203] Nodes topology is not available, providing CPU topology
1月 06 17:39:35 master-node kubelet[4317]: W0106 17:39:35.624994    4317 machine.go:65] Cannot read vendor id correctly, set empty.
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.627906    4317 server.go:659] "--cgroups-per-qos enabled, but --cgroup-root was not specified.  defaulting to /"
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.628737    4317 container_manager_linux.go:267] "Container manager verified user specified cgroup-root exists" cgroupRoot=[]
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.629081    4317 container_manager_linux.go:272] "Creating Container Manager object based on Node Config" nodeConfig={RuntimeCgroupsName: SystemCgroupsName: KubeletCgroupsName: Ku>
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.629182    4317 topology_manager.go:134] "Creating topology manager with policy per scope" topologyPolicyName="none" topologyScopeName="container"
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.629234    4317 container_manager_linux.go:308] "Creating device plugin manager"
1月 06 17:39:35 master-node kubelet[4317]: I0106 17:39:35.629361    4317 state_mem.go:36] "Initialized new in-memory state store"
1月 06 17:39:35 master-node kubelet[4317]: E0106 17:39:35.635467    4317 run.go:74] "command failed" err="failed to run Kubelet: validate service connection: CRI v1 runtime API is not implemented for endpoint \"unix:///var/run/containe>
1月 06 17:39:35 master-node systemd[1]: kubelet.service: Main process exited, code=exited, status=1/FAILURE
1月 06 17:39:35 master-node systemd[1]: kubelet.service: Failed with result 'exit-code'.
1月 06 17:39:45 master-node systemd[1]: kubelet.service: Scheduled restart job, restart counter is at 137.
1月 06 17:39:45 master-node systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
1月 06 17:39:45 master-node systemd[1]: Started kubelet: The Kubernetes Node Agent.
1月 06 17:39:46 master-node kubelet[4327]: Flag --pod-infra-container-image has been deprecated, will be removed in 1.27. Image garbage collector will get sandbox image information from CRI.
1月 06 17:39:46 master-node kubelet[4327]: I0106 17:39:46.088310    4327 server.go:198] "--pod-infra-container-image will not be pruned by the image garbage collector in kubelet and should also be set in the remote runtime"
1月 06 17:39:46 master-node kubelet[4327]: Flag --pod-infra-container-image has been deprecated, will be removed in 1.27. Image garbage collector will get sandbox image information from CRI.
1月 06 17:39:46 master-node kubelet[4327]: I0106 17:39:46.103011    4327 server.go:412] "Kubelet version" kubeletVersion="v1.26.0"
1月 06 17:39:46 master-node kubelet[4327]: I0106 17:39:46.103108    4327 server.go:414] "Golang settings" GOGC="" GOMAXPROCS="" GOTRACEBACK=""
1月 06 17:39:46 master-node kubelet[4327]: I0106 17:39:46.104167    4327 server.go:836] "Client rotation is on, will bootstrap in background"
1月 06 17:39:46 master-node kubelet[4327]: I0106 17:39:46.110356    4327 certificate_store.go:130] Loading cert/key pair from "/var/lib/kubelet/pki/kubelet-client-current.pem".
1月 06 17:39:46 master-node kubelet[4327]: I0106 17:39:46.113188    4327 dynamic_cafile_content.go:157] "Starting controller" name="client-ca-bundle::/etc/kubernetes/pki/ca.crt"
lines 1-55

感谢各位大佬

讨论数量: 2

服务起不来 它让我关swap我这不是关了吗?(服务也重启了啊)

file

file

1年前 评论

解决了吗

1年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!