Reputation: 4512
I have recently installed Docker
and the gcloud SDK
on a Windows 10 machine.
After running gcloud init
and configuring my local setup, I ran gcloud components install kubectl
.
Now when I run kubectl get pods
I get the response
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.
I then ran kubectl config view
and got the following
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
I'm not sure how to fix this on Windows as I am normally a Mac user so this is all new to me.
How can my instance of kubectl
connect?
Upvotes: 0
Views: 898
Reputation: 2795
Generally if you want to configure your kubectl to use your GKE cluster, you have to run below commands to copy k8s configuration to local.
1.First list your cluster names (under NAME column) and recognize zone (under Location column)
$ gcloud container clusters list
2.Then run below command to copy k8s config to local
$ gcloud container clusters get-credentials <cluster-name> --zone <zone>
3.Then check config
$ kubectl config view
Upvotes: 1
Reputation: 1501
I saw people running into this issue on Windows by not realizing that in File Explorer file extensions are hidden by default, so while they wanted to create a file called "config", they actually created a file called "config.txt" and that's not found by kubectl.
Upvotes: 1
Reputation: 4512
I ended up deleting windows and install Ubuntu. Windows was a nightmare.
Upvotes: 0