Getting connection error 4 min after master node installation `kubeadm init `

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes v12.26.4:
Cloud being used: bare-metal - fresh
Installation method:
Host OS: Fresh Ubuntu install ““Ubuntu 22.04.2 LTS””
CNI and version: Installation didn’t go that far
CRI and version: containerd 1.6.20

Issue

Using kubeadm version: v1.26.4,

I followed the exact documentation:

https://kubernetes.io/docs/concepts/cluster-administration/addons/

I use the following command to install a master node:

sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=10.11.1.106

After installation done, I use the following command and I get the single node create:

kubectl get nodes

kubectl get pods -A


NAMESPACE NAME READY STATUS RESTARTS AGE

kube-system coredns-787d4945fb-7nlgl 0/1 Pending 0 4m17s

kube-system coredns-787d4945fb-kmzkk 0/1 Pending 0 4m18s

kube-system etcd-v106 1/1 Running 1 (5m26s ago) 4m53s

kube-system kube-apiserver-v106 1/1 Running 2 (2m41s ago) 4m53s

kube-system kube-controller-manager-v106 1/1 Running 4 (108s ago) 4m53s

kube-system kube-proxy-x6k9x 0/1 CrashLoopBackOff 3 (6s ago) 4m18s

kube-system kube-scheduler-v106 1/1 Running 3 (2m48s ago) 5m31s

Important: Note the number of restarts

After 3-4 minute, I get this error most of the times:


kubectl get pods -A 

The connection to the server [10.11.1.106:6443](https://10.11.1.106:6443/) was refused - did you specify the right host or port?

The error blocks me to install a CNI driver.

Logs from kube-apiserver

root@v106:/var/log/pods/kube-system_kube-apiserver-v106_d4ab5771449e1b66f590da3eecba3f56/kube-apiserver# cat 207.log
2023-05-10T23:32:27.586099032Z stderr F I0510 23:32:27.585899       1 server.go:555] external host was not specified, using 10.11.1.106
2023-05-10T23:32:27.586928Z stderr F I0510 23:32:27.586854       1 server.go:163] Version: v1.26.4
2023-05-10T23:32:27.587103096Z stderr F I0510 23:32:27.587032       1 server.go:165] "Golang settings" GOGC="" GOMAXPROCS="" GOTRACEBACK=""
2023-05-10T23:32:27.83369396Z stderr F I0510 23:32:27.833600       1 shared_informer.go:270] Waiting for caches to sync for node_authorizer
2023-05-10T23:32:27.835127985Z stderr F I0510 23:32:27.835068       1 plugins.go:158] Loaded 12 mutating admission controller(s) successfully in the following order: NamespaceLifecycle,LimitRanger,ServiceAccount,NodeRestriction,TaintNodesByCondition,Priority,DefaultTolerationSeconds,DefaultStorageClass,StorageObjectInUseProtection,RuntimeClass,DefaultIngressClass,MutatingAdmissionWebhook.
2023-05-10T23:32:27.8352372Z stderr F I0510 23:32:27.835180       1 plugins.go:161] Loaded 12 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,PodSecurity,Priority,PersistentVolumeClaimResize,RuntimeClass,CertificateApproval,CertificateSigning,CertificateSubjectRestriction,ValidatingAdmissionPolicy,ValidatingAdmissionWebhook,ResourceQuota.
2023-05-10T23:32:27.886410093Z stderr F W0510 23:32:27.886300       1 genericapiserver.go:660] Skipping API apiextensions.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:27.887507827Z stderr F I0510 23:32:27.887448       1 instance.go:277] Using reconciler: lease
2023-05-10T23:32:28.092549476Z stderr F I0510 23:32:28.092315       1 instance.go:621] API group "internal.apiserver.k8s.io" is not enabled, skipping.
2023-05-10T23:32:28.382498466Z stderr F I0510 23:32:28.382384       1 instance.go:621] API group "resource.k8s.io" is not enabled, skipping.
2023-05-10T23:32:28.4889039Z stderr F W0510 23:32:28.488791       1 genericapiserver.go:660] Skipping API authentication.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.48892182Z stderr F W0510 23:32:28.488812       1 genericapiserver.go:660] Skipping API authentication.k8s.io/v1alpha1 because it has no resources.
2023-05-10T23:32:28.490892595Z stderr F W0510 23:32:28.490810       1 genericapiserver.go:660] Skipping API authorization.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.495583795Z stderr F W0510 23:32:28.495522       1 genericapiserver.go:660] Skipping API autoscaling/v2beta1 because it has no resources.
2023-05-10T23:32:28.495595174Z stderr F W0510 23:32:28.495538       1 genericapiserver.go:660] Skipping API autoscaling/v2beta2 because it has no resources.
2023-05-10T23:32:28.498477296Z stderr F W0510 23:32:28.498382       1 genericapiserver.go:660] Skipping API batch/v1beta1 because it has no resources.
2023-05-10T23:32:28.500814239Z stderr F W0510 23:32:28.500748       1 genericapiserver.go:660] Skipping API certificates.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.502840842Z stderr F W0510 23:32:28.502764       1 genericapiserver.go:660] Skipping API coordination.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.50288497Z stderr F W0510 23:32:28.502822       1 genericapiserver.go:660] Skipping API discovery.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.508240075Z stderr F W0510 23:32:28.508146       1 genericapiserver.go:660] Skipping API networking.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.508251494Z stderr F W0510 23:32:28.508160       1 genericapiserver.go:660] Skipping API networking.k8s.io/v1alpha1 because it has no resources.
2023-05-10T23:32:28.510107384Z stderr F W0510 23:32:28.510014       1 genericapiserver.go:660] Skipping API node.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.510118093Z stderr F W0510 23:32:28.510028       1 genericapiserver.go:660] Skipping API node.k8s.io/v1alpha1 because it has no resources.
2023-05-10T23:32:28.510122095Z stderr F W0510 23:32:28.510072       1 genericapiserver.go:660] Skipping API policy/v1beta1 because it has no resources.
2023-05-10T23:32:28.519954949Z stderr F W0510 23:32:28.519890       1 genericapiserver.go:660] Skipping API rbac.authorization.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.520061514Z stderr F W0510 23:32:28.519993       1 genericapiserver.go:660] Skipping API rbac.authorization.k8s.io/v1alpha1 because it has no resources.
2023-05-10T23:32:28.524080631Z stderr F W0510 23:32:28.524022       1 genericapiserver.go:660] Skipping API scheduling.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.524176228Z stderr F W0510 23:32:28.524116       1 genericapiserver.go:660] Skipping API scheduling.k8s.io/v1alpha1 because it has no resources.
2023-05-10T23:32:28.544063956Z stderr F W0510 23:32:28.543959       1 genericapiserver.go:660] Skipping API storage.k8s.io/v1alpha1 because it has no resources.
2023-05-10T23:32:28.549581403Z stderr F W0510 23:32:28.549484       1 genericapiserver.go:660] Skipping API flowcontrol.apiserver.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.54959339Z stderr F W0510 23:32:28.549500       1 genericapiserver.go:660] Skipping API flowcontrol.apiserver.k8s.io/v1alpha1 because it has no resources.
2023-05-10T23:32:28.557058162Z stderr F W0510 23:32:28.556802       1 genericapiserver.go:660] Skipping API apps/v1beta2 because it has no resources.
2023-05-10T23:32:28.557076954Z stderr F W0510 23:32:28.556835       1 genericapiserver.go:660] Skipping API apps/v1beta1 because it has no resources.
2023-05-10T23:32:28.559174096Z stderr F W0510 23:32:28.559073       1 genericapiserver.go:660] Skipping API admissionregistration.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.559185408Z stderr F W0510 23:32:28.559087       1 genericapiserver.go:660] Skipping API admissionregistration.k8s.io/v1alpha1 because it has no resources.
2023-05-10T23:32:28.561045307Z stderr F W0510 23:32:28.560924       1 genericapiserver.go:660] Skipping API events.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:28.584050598Z stderr F W0510 23:32:28.583937       1 genericapiserver.go:660] Skipping API apiregistration.k8s.io/v1beta1 because it has no resources.
2023-05-10T23:32:29.349708345Z stderr F I0510 23:32:29.349561       1 dynamic_cafile_content.go:157] "Starting controller" name="request-header::/etc/kubernetes/pki/front-proxy-ca.crt"
2023-05-10T23:32:29.34988612Z stderr F I0510 23:32:29.349762       1 dynamic_cafile_content.go:157] "Starting controller" name="client-ca-bundle::/etc/kubernetes/pki/ca.crt"
2023-05-10T23:32:29.350176964Z stderr F I0510 23:32:29.350108       1 dynamic_serving_content.go:132] "Starting controller" name="serving-cert::/etc/kubernetes/pki/apiserver.crt::/etc/kubernetes/pki/apiserver.key"
2023-05-10T23:32:29.3503322Z stderr F I0510 23:32:29.350279       1 secure_serving.go:210] Serving securely on [::]:6443
2023-05-10T23:32:29.350507143Z stderr F I0510 23:32:29.350455       1 controller.go:211] Shutting down kubernetes service endpoint reconciler
2023-05-10T23:32:29.35059681Z stderr F I0510 23:32:29.350541       1 tlsconfig.go:240] "Starting DynamicServingCertificateController"
2023-05-10T23:32:29.350882015Z stderr F I0510 23:32:29.350820       1 controller.go:80] Starting OpenAPI V3 AggregationController
2023-05-10T23:32:29.351521053Z stderr F I0510 23:32:29.351460       1 cluster_authentication_trust_controller.go:440] Starting cluster_authentication_trust_controller controller
2023-05-10T23:32:29.351607119Z stderr F I0510 23:32:29.351554       1 shared_informer.go:270] Waiting for caches to sync for cluster_authentication_trust_controller
2023-05-10T23:32:29.35194402Z stderr F I0510 23:32:29.351887       1 controller.go:121] Starting legacy_token_tracking_controller
2023-05-10T23:32:29.35202534Z stderr F I0510 23:32:29.351974       1 shared_informer.go:270] Waiting for caches to sync for configmaps
2023-05-10T23:32:29.352692544Z stderr F I0510 23:32:29.352620       1 apiservice_controller.go:97] Starting APIServiceRegistrationController
2023-05-10T23:32:29.352804431Z stderr F I0510 23:32:29.352747       1 cache.go:32] Waiting for caches to sync for APIServiceRegistrationController controller
2023-05-10T23:32:29.353164393Z stderr F I0510 23:32:29.353109       1 gc_controller.go:78] Starting apiserver lease garbage collector
2023-05-10T23:32:29.353259627Z stderr F I0510 23:32:29.350521       1 dynamic_serving_content.go:132] "Starting controller" name="aggregator-proxy-cert::/etc/kubernetes/pki/front-proxy-client.crt::/etc/kubernetes/pki/front-proxy-client.key"
2023-05-10T23:32:29.35344104Z stderr F I0510 23:32:29.353387       1 dynamic_cafile_content.go:157] "Starting controller" name="client-ca-bundle::/etc/kubernetes/pki/ca.crt"
2023-05-10T23:32:29.353605193Z stderr F I0510 23:32:29.353548       1 autoregister_controller.go:141] Starting autoregister controller
2023-05-10T23:32:29.353614622Z stderr F I0510 23:32:29.353565       1 cache.go:32] Waiting for caches to sync for autoregister controller
2023-05-10T23:32:29.353707198Z stderr F I0510 23:32:29.353644       1 dynamic_cafile_content.go:157] "Starting controller" name="request-header::/etc/kubernetes/pki/front-proxy-ca.crt"
2023-05-10T23:32:29.354024555Z stderr F I0510 23:32:29.353965       1 apf_controller.go:361] Starting API Priority and Fairness config controller
2023-05-10T23:32:29.354380878Z stderr F I0510 23:32:29.354319       1 available_controller.go:494] Starting AvailableConditionController
2023-05-10T23:32:29.354390746Z stderr F I0510 23:32:29.354333       1 cache.go:32] Waiting for caches to sync for AvailableConditionController controller
2023-05-10T23:32:29.354421376Z stderr F I0510 23:32:29.354359       1 controller.go:83] Starting OpenAPI AggregationController
2023-05-10T23:32:29.35485709Z stderr F I0510 23:32:29.354795       1 customresource_discovery_controller.go:288] Starting DiscoveryController
2023-05-10T23:32:29.35740154Z stderr F I0510 23:32:29.357337       1 controller.go:85] Starting OpenAPI controller
2023-05-10T23:32:29.357420082Z stderr F I0510 23:32:29.357384       1 controller.go:85] Starting OpenAPI V3 controller
2023-05-10T23:32:29.362142629Z stderr F I0510 23:32:29.362079       1 naming_controller.go:291] Starting NamingConditionController
2023-05-10T23:32:29.362288259Z stderr F I0510 23:32:29.362238       1 establishing_controller.go:76] Starting EstablishingController
2023-05-10T23:32:29.362374864Z stderr F I0510 23:32:29.362331       1 nonstructuralschema_controller.go:192] Starting NonStructuralSchemaConditionController
2023-05-10T23:32:29.362463243Z stderr F I0510 23:32:29.362419       1 apiapproval_controller.go:186] Starting KubernetesAPIApprovalPolicyConformantConditionController
2023-05-10T23:32:29.362564812Z stderr F I0510 23:32:29.362504       1 crd_finalizer.go:266] Starting CRDFinalizer
2023-05-10T23:32:29.362839893Z stderr F E0510 23:32:29.362778       1 controller.go:214] Unable to remove endpoints from kubernetes service: StorageError: key not found, Code: 1, Key: /registry/masterleases/10.11.1.106, ResourceVersion: 0, AdditionalErrorMsg:
2023-05-10T23:32:29.363004956Z stderr F I0510 23:32:29.362947       1 controller.go:86] Shutting down OpenAPI V3 AggregationController
2023-05-10T23:32:29.363142831Z stderr F E0510 23:32:29.363072       1 controller.go:91] timed out waiting for caches to sync
2023-05-10T23:32:29.363215818Z stderr F I0510 23:32:29.363170       1 controller.go:92] Shutting down OpenAPI controller
2023-05-10T23:32:29.363317695Z stderr F E0510 23:32:29.363269       1 controller.go:90] timed out waiting for caches to sync
2023-05-10T23:32:29.363392473Z stderr F I0510 23:32:29.363347       1 naming_controller.go:295] Shutting down NamingConditionController
2023-05-10T23:32:29.363479417Z stderr F I0510 23:32:29.363437       1 establishing_controller.go:80] Shutting down EstablishingController
2023-05-10T23:32:29.363560163Z stderr F I0510 23:32:29.363522       1 nonstructuralschema_controller.go:196] Shutting down NonStructuralSchemaConditionController
2023-05-10T23:32:29.363631719Z stderr F I0510 23:32:29.363591       1 apiapproval_controller.go:190] Shutting down KubernetesAPIApprovalPolicyConformantConditionController
2023-05-10T23:32:29.363733766Z stderr F I0510 23:32:29.363688       1 crd_finalizer.go:270] Shutting down CRDFinalizer
2023-05-10T23:32:29.363984368Z stderr F F0510 23:32:29.363937       1 hooks.go:203] PostStartHook "crd-informer-synced" failed: timed out waiting for the condition
2023-05-10T23:32:29.405515921Z stderr F E0510 23:32:29.405454       1 customresource_discovery_controller.go:291] timed out waiting for caches to sync
2023-05-10T23:32:29.405595818Z stderr F I0510 23:32:29.405510       1 crdregistration_controller.go:111] Starting crd-autoregister controller
2023-05-10T23:32:29.405651104Z stderr F I0510 23:32:29.405610       1 shared_informer.go:270] Waiting for caches to sync for crd-autoregister
2023-05-10T23:32:29.40574449Z stderr F E0510 23:32:29.405697       1 cache.go:35] Unable to sync caches for AvailableConditionController controller
2023-05-10T23:32:29.40583329Z stderr F F0510 23:32:29.405776       1 hooks.go:203] PostStartHook "priority-and-fairness-config-producer" failed: APF bootstrap ensurer timed out waiting for cache sync
2023-05-10T23:32:29.448611912Z stderr F E0510 23:32:29.448542       1 gc_controller.go:84] timed out waiting for caches to sync
2023-05-10T23:32:29.448703054Z stderr F I0510 23:32:29.448639       1 dynamic_serving_content.go:146] "Shutting down controller" name="aggregator-proxy-cert::/etc/kubernetes/pki/front-proxy-client.crt::/etc/kubernetes/pki/front-proxy-client.key"
2023-05-10T23:32:29.448826092Z stderr F I0510 23:32:29.448762       1 object_count_tracker.go:151] "StorageObjectCountTracker pruner is exiting"
2023-05-10T23:32:29.4489124Z stderr F E0510 23:32:29.448860       1 cache.go:35] Unable to sync caches for APIServiceRegistrationController controller
2023-05-10T23:32:29.448978268Z stderr F E0510 23:32:29.448937       1 shared_informer.go:273] unable to sync caches for configmaps
2023-05-10T23:32:29.449054961Z stderr F I0510 23:32:29.449003       1 controller.go:89] Shutting down OpenAPI AggregationController
2023-05-10T23:32:29.449234156Z stderr F I0510 23:32:29.449181       1 dynamic_cafile_content.go:171] "Shutting down controller" name="request-header::/etc/kubernetes/pki/front-proxy-ca.crt"
2023-05-10T23:32:29.449358206Z stderr F I0510 23:32:29.449281       1 dynamic_cafile_content.go:171] "Shutting down controller" name="client-ca-bundle::/etc/kubernetes/pki/ca.crt"
2023-05-10T23:32:29.450408973Z stderr F I0510 23:32:29.450342       1 controller.go:157] Shutting down quota evaluator

I see people over youtube, installing K8 with steps same as me with no issues.

how can I fix this? What am I doing wrong?

Hello am510, did you try with different CRI, like docker engine?
Make sure that your VM have enough resources (2vcpu 2gb ram). I followed many times official documentarion and it’s worked without problem