Kubernetes Deep Dive Room

Sign Up Free or Log In to participate!

How did you setup your powershell to run the kubectl ?

I have also tried executing kubectl get nodes from GCP console and it gives he connection to the server localhost:8080 was refused - did you specify the right host or port? output. 
Kindly let us know how to setup environment to run kubectl commands.

2 Answers

If you’re using Docker Desktop for Windows, you need to enable Kubernetes first. Right click on the Docker Desktop icon in the tray, go to Settings, then the Kubernetes tab and then tick the enable box to install Kubernetes.

projectid=""  
zone="europe-west2-a"  
region="europe-west2"  
cluster01=""  
serviceaccount="api-service-account"  
function_update_gcloud () {  
gcloud config set compute/region $region  
gcloud config set compute/zone $zone  
gcloud config set project $projectid  
}  
function_Create_cluster () {  
echo " build GKE cluster"  
gcloud container clusters create $cluster01   
--num-nodes 2   
--machine-type n1-standard-2   
--scopes "https://www.googleapis.com/auth/projecthosting,cloud-platform"  
gcloud container clusters get-credentials   
$cluster01 --zone $zone --project $projectid  
}  
function_bind_gcloud_as_Admin () {  
ACCOUNT=$(gcloud info --format='value(config.account)')  
kubectl create clusterrolebinding owner-cluster-admin-binding   
--clusterrole cluster-admin   
--user $ACCOUNT  
}

fill in the variables at the top

also run this to check its up

kubectl get svc

and i also recommend you curl the APIs

Kiran Sukumaran

can you please clarify a little? Where does this config need to be specified?

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?