Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skaffold dev unable to connect to Kubernetes: getting client config for Kubernetes client #6806

Closed
uchenxy opened this issue Nov 5, 2021 · 9 comments

Comments

@uchenxy
Copy link

uchenxy commented Nov 5, 2021

image

image

### unable to connect to Kubernetes: getting client config for Kubernetes client: error creating REST client config in-cluster: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined

why? thank you!

@briandealwis
Copy link
Member

@uchenxy can you please confirm that the use of KUBECONFIG_PATH is a redacted version of the path to your kubeconfig file?

Could you try running skaffold dev -v debug and include the full output?

@uchenxy
Copy link
Author

uchenxy commented Nov 11, 2021

@briandealwis
this is the full output

@uchenxy can you please confirm that the use of KUBECONFIG_PATH is a redacted version of the path to your kubeconfig file?

Could you try running skaffold dev -v debug and include the full output?

image
this is the full output,Thank you for your answer

@briandealwis
Copy link
Member

The key here is the line after your highlight:

 no kube-context set and no kubeConfig found, attempting in-cluster config

you need to provide your KUBECONFIG to skaffold too, like

skaffold dev —kubeconfig path

Skaffold will pass that down to Helm.

Skaffold also talks to your cluster and when it cannot determine which cluster to use, it tries to see if it’s running within a cluster.

We should make that error more clear.

@uchenxy
Copy link
Author

uchenxy commented Nov 12, 2021

Although this does not achieve my goal, thank you for your answer

@uchenxy uchenxy closed this as completed Nov 12, 2021
@Derry-ukere
Copy link

any soluton to this yet?

@Derry-ukere
Copy link

`Starting deploy...
Cleaning up...
WARN[0001] deployer cleanup:kubectl create: running [kubectl --context create --dry-run=client -oyaml -f /home/avenger/Desktop/devops/hello-world/infra/k8s/ConfigMap.yaml -f /home/avenger/Desktop/devops/hello-world/infra/k8s/cronjob.yaml -f /home/avenger/Desktop/devops/hello-world/infra/k8s/ingress-config.yaml -f /home/avenger/Desktop/devops/hello-world/infra/k8s/star-wars-depl-two.yaml -f /home/avenger/Desktop/devops/hello-world/infra/k8s/star-wars-depl.yaml]

  • stdout: ""
  • stderr: "Error from server (NotFound): the server could not find the requested resource\n"
  • cause: exit status 1 subtask=-1 task=DevLoop
    unable to connect to Kubernetes: getting client config for Kubernetes client: error creating REST client config in-cluster: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
    `

@MarlonGamez
Copy link
Contributor

hey there @Derry-ukere , are you running into this issue using a similar setup? It seems you're using kubectl deployer and running into the same issue. Any more info on your config here would be great, thanks!

@AfhaamANJ
Copy link

Any solutions for this issue ?

@Adeku5080
Copy link

currently experiencing this issue when I run skaffold dev command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants