Unable to connect to the server is displayed in kubernetes

Asked 1 years ago, Updated 1 years ago, 111 views

When I tried to use docker desktop kubernetes in accordance with the reference book on a Windows 10 pro machine, the following error occurred in the command kubetcl cluster-info.

Unable to connect to the server:Service Unavailable

kubectl config view results were as follows:

 apiVersion:v1
clusters:
- cluster:
    certificate-authority-data —DATA+OMITTED
    server:https://kubernetes.docker.internal:6443
  name —docker-desktop
contexts:
- context:
    cluster —docker-desktop
    user —docker-desktop
  name —docker-desktop
- context:
    cluster —docker-desktop
    user —docker-desktop
  name —docker-for-desktop
current-context —docker-desktop
kind—Config
preferences:{}
users:
- name —docker-desktop
  user:
    client-certificate-data —REDACTED
    client-key-data —REDACTED

I searched online and tried the following, but it didn't work.

  • Delete docker images, containers, and volumes to free up space

  • Adjust Resource

    • CPUs:7
    • Memory: 18.50 GB
    • Swap: 4GB
    • Disk image size 128GB (54.9GB used)
  • Specify cluster server in kubectl config

  • Restart Docker Desktop

Remove docker images, containers, and volumes to free up space

Adjust Resource

  • CPUs:7
  • Memory: 18.50 GB
  • Swap: 4GB
  • Disk image size 128GB (54.9GB used)

Specify cluster server in kubectl config

Restart Docker Desktop

I use docker desktop on Windows 10 pro.

The versions are as follows:

  • docker desktop community: 2.2.0.5
  • Docker Engine: 19.03.8
  • Notary: 0.6.1
  • Compose: 1.25.4
  • Credential Helper: 0.6.3
  • Kubernetes:1.15.5

Once this problem has been resolved, we are thinking of moving nginx in the manifest file in the next step.

I can't find a solution by myself, so I wrote it here to ask for your advice.
If you have any missing information, please reply.

Thank you for your cooperation.

docker windows-10 kubernetes

2022-09-30 17:36

1 Answers

Have you solved the name of kubernetes.docker.internal?
I was in the same situation, but I have access to localhost:6443, so
Changed etc/hosts to resolve kubernetes.docker.internal to 127.0.0.1.
In addition, my environment had a proxy, so I would like to make sure that kubernetes.docker.internal does not go through the proxy.
Resolved by adding kubernetes.docker.internal to no_proxy


2022-09-30 17:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.