<p>1.)
Execute the following command to generate a random number which is used in the later steps</p>

<pre><code>NUMBER=$[ ( $RANDOM % 1000 ) + 1 ]

echo $NUMBER
</code></pre>

<p><strong>Note</strong>: Replace the sentence your random number with the number that you have generated wherever you have found the sentence.</p>

<p>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.</p>

<p>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.</p>

<p>Execute the following command to view the pod that is running in the nginx container.**</p>

<p>3.)
First, you need to expose the Nginx container to the internet.</p>

<p>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.</p>

<pre><code>kubectl get services
</code></pre>

<p>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.</p>

<blockquote>
  <blockquote>
    <p>I have used the below code so far,  but the lb is not working:</p>
  </blockquote>
</blockquote>

<pre><code>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
</code></pre>

sassofgeeks
<p>The reason it's not working because the port is not exposed by the Pod. Please run the below command instead of the second command.</p>

<p><code>kubectl run mycluster --image=gcr.io/cloud-marketplace/google/nginx1 --port=80</code></p>

<p>This command should create the deployment and exposed the <code>containerPort</code> on 80 as well which your service would be able to hit.</p>
