Local Access to GKE
with gcloud
Q: What Is Container Engine (GKE)
A: Managed Kubernetes from Google
- Google runs the Kubernetes master and etcd instances
- Infrastructure is provided by Google Cloud Platform
- Built in Logging, Monitoring, etc
- Worker nodes are GCE instances in your project
### GKE Pricing
* First 5 nodes are free, $.15/hr over 5 nodes
* Worker nodes are priced separately (through GCE)
## GCP Project Access
Workshop Attendees:
1. Log in to GCP using the provided username & password at:
[console.cloud.google.com](https://console.cloud.google.com)
2. Accept the Terms of Service
3. Select the workshop project from drop-down menu
![Select project](http://i.imgur.com/kEjJ1pT.png)
Remote Workshop Participants
- Login to GCP using your Google account at:
console.cloud.google.com
- Accept the Terms of Service
- Create a Billing Account
- Sign up for the $300 12/month free trial
- https://console.cloud.google.com/freetrial
- Your credit card won't be charged at end of free trial
- Create a new project for this workshop
## Cloud Shell
1. A free GCE instance for your project
2. A cloud-based CLI environment, available on-demand
3. An excellent alternative for folks who lack a local environment to work in
![Cloud Shell](https://cloud.google.com/shell/docs/images/shell_icon.png)
The top left menu icon provides access to:
- API Manager (enable new APIs)
- Billing
- Logging and Monitoring
- Compute Engine
- Container Engine
For now, click Container Engine and wait for initialization…
Installing the gcloud
CLI
Command line tool for interacting with GCP resources
curl https://sdk.cloud.google.com | bash
exec -l $SHELL # restart shell
Other install instructions are available on the Google Cloud SDK Download page
Use kubectl
to manage Kubernetes resources, and gcloud
to manage GCP resources
Configuring glcoud
Configure gcloud to use the correct project and availability zone
gcloud config set project your-project-id
gcloud config set compute/zone us-central1-b
List all clusters
gcloud container clusters list
Create a new cluster. Compute Engine will require a few minutes to initialize new projects
gcloud container clusters create test-cluster
Verify GKE Accessibility
To verify that both GKE and gcloud
have been configured correctly, switch your kubectl
context to GKE:
gcloud container clusters get-credentials test-cluster
Then, list your GCE-provided Kubernetes worker nodes:
kubectl get nodes
If kubectl
isn't available, you may need to configure your machine for local development with the k8s-minikube workshop.