Learn how to create a production-grade Kubernetes cluster to deploy your application.
This section requires basic understanding of Docker and container images - make sure you do the tutorial in sequence.
gcloud services enable compute.googleapis.com
gcloud services enable container.googleapis.com
While it's easy to create a Kubernetes Engine cluster, it takes a bit more to provision a production-grade cluster. This cluster will enable many features for production use:
PROJECT_ID=$(gcloud config get-value project)
gcloud container clusters create demo-cluster \
--num-nodes 4 \
--machine-type n1-standard-4 \
Kubernetes credentials are automatically retrieved and stored in your
$HOME/.kube/configfile. If you need to re-retrieve the credential:
gcloud container clusters get-credentials demo-cluster
The Kubernetes cluster is composed of multiple Nodes - each node is a Compute Engine Virtual Machine. When you deploy a container image into Kubernetes, a container instance is ultimately scheduled and ran on one of the Nodes.
In Kubernetes Engine, theses nodes are managed by a Node Pool, which is a set of homogenous Compute Engine Virtual Machines (i.e., they have exactly the same configuration, such as machine type, disk, operation system, etc).
You can see a list of Virtual Machines using
gcloud compute instances list
You can also use
kubectlto list the nodes that belong to the current cluster:
kubectl get nodes
You can also SSH into the node directly if needed, by specifying the name of the node:
gcloud compute ssh gke-demo-cluster-default-pool-...
Once you are in the Compute Engine Virtual Machine, you can also see the containers that are running inside of the Node: