Sign up to google cloud here.
To enable “Kubernetes Engine API” under API and services, open cloud shell and type
gcloud config set compute/zone us-central1-a
gcloud container clusters create gdg-demo
-
To get authentication credentials to interact with the cluster
gcloud container clusters get-credentials gdg-demo
-
Use the public container and create a new deployment “hello-server”
'kubectl run hello-server --image=gcr.io/google-samples/hello-app:1.0 --port 8080' -
List all deployments
kubectl get deployments
-
Create new service “load balancer”
kubectl expose deployment hello-server --type="LoadBalancer"
-
List all services
kubectl get svc
-
Inspect new server by
kubectl get service hello-server
-
Open http:https://external-ip:8080 in new browser and try these commands
kubectl get pods
kubectl scale deployemnts hello-server --replicas=5
kubectl get pods
kubectl scale deployments hello-server --replicas=3
kubectl get pods
- Clean up the resources
gcloud container clusters delete gdg-demo