Introduction #
In this section we will create a zonal cluster and deploy a simple image to the cluster. In later docs we will deep dive into the each component with detailed configurations.
Login to gcp #
$ gcloud auth login [email protected]
Set your project #
gcloud config set project <project-name>
Set your default zone #
gcloud config set compute/zone [COMPUTE_ZONE]
gcloud config set compute/zone asia-east1-a

Create a zonal cluster #
gcloud container clusters create [CLUSTER_NAME] [--zone [COMPUTE_ZONE]]
gcloud container clusters create demo-zonal-cluster --zone asia-southeast1-a \
--node-locations asia-southeast1-a,asia-southeast1-b, --num-nodes 2 \
--enable-autoupgrade --enable-autorepair \
--enable-cloud-logging --enable-cloud-monitoring

Connect to cluster #
gcloud container clusters get-credentials demo-zonal-cluster --zone asia-southeast1-a --project <your-project-name>
- list nodes of the cluster

Create a deployment #
dc-myapp.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
run: my-app
template:
metadata:
labels:
run: my-app
spec:
containers:
- name: hello-app
image: gcr.io/google-samples/hello-app:1.0
kubectl apply -f dc-myapp.yaml
