1.) Execute the following command to generate a random number which is used in the later steps
NUMBER=$[ ( $RANDOM % 1000 ) + 1 ]
echo $NUMBER
Note: Replace the sentence your random number with the number that you have generated wherever you have found the sentence.
Your task is to start a Kubernetes Engine managed by Kubernetes Cluster with the name mycluster-your random number and configure it to run 2 nodes.
2.) Run and Deploy a Container Here, you need to launch a single instance of the Nginx container (with version 1.10.0) from the cloud shell.
Execute the following command to view the pod that is running in the nginx container.**
3.) First, you need to expose the Nginx container to the internet.
Kubernetes will create a service with an external load balancer with a public IP address. You can view your service by executing the following command.
kubectl get services
Now, you will get the external IP address of the Nginx cluster. Open the new web browser tab and paste the Cluster External IP address. You should get the default home page of the Nginx browser.
I have used the below code so far, but the lb is not working:
gcloud container clusters create mycluster-5 --zone=us-central1-a
kubectl create deployment mycluster --image=gcr.io/cloud-marketplace/google/nginx1
kubectl set image deployment nginx nginx=nginx:1.9.1
kubectl expose deployment mycluster-727 --type LoadBalancer --port 80 --target-port 8080
service/mycluster-727 exposed