Orchestrating the Cloud with Kubernetes

Task 1. Get the sample code
Copy the source code from the Cloud Shell command line:

gsutil cp -r gs://spls/gsp021/* .

cd orchestrate-with-kubernetes/kubernetes
                              
student_04_1c515c556d93@cloudshell:~ (qwiklabs-gcp-03-ef6a7d727fd0)$ cd orchestrate-with-kubernetes/kubernetes
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ ls -l
total 24
-rw-r--r-- 1 student_04_1c515c556d93 student_04_1c515c556d93  283 Aug  1 22:06 cleanup.sh
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 deployments
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 nginx
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 pods
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 services
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 tls
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ ls -l pods/
total 12
-rw-r--r-- 1 student_04_1c515c556d93 student_04_1c515c556d93  718 Aug  1 22:06 healthy-monolith.yaml
-rw-r--r-- 1 student_04_1c515c556d93 student_04_1c515c556d93  454 Aug  1 22:06 monolith.yaml
-rw-r--r-- 1 student_04_1c515c556d93 student_04_1c515c556d93 1262 Aug  1 22:06 secure-monolith.yaml
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ ls -l
total 24
-rw-r--r-- 1 student_04_1c515c556d93 student_04_1c515c556d93  283 Aug  1 22:06 cleanup.sh
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 deployments
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 nginx
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 pods
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 services
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 tls


Task 2. Quick Kubernetes Demo



student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl create deployment nginx --image=nginx:1.10.0
deployment.apps/nginx created


student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
nginx-79bb7d4b87-6nrqm   1/1     Running   0          11s
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.72.0.1    <none>        443/TCP   4m31s
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl expose deployment nginx --port 80 --type LoadBalancer
service/nginx exposed
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP      10.72.0.1      <none>        443/TCP        4m39s
nginx        LoadBalancer   10.72.14.139   <pending>     80:30113/TCP   4s
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)        AGE
kubernetes   ClusterIP      10.72.0.1      <none>          443/TCP        5m43s
nginx        LoadBalancer   10.72.14.139   34.68.183.219   80:30113/TCP   68s
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl http://34.68.183.219:80
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

Task 3. Pods

At the core of Kubernetes is the Pod.

Pods represent and hold a collection of one or more containers. Generally, if you have multiple containers with a hard dependency on each other, you package the containers inside a single pod.

Pod containing the monolith and nginx containers

In this example there is a pod that contains the monolith and nginx containers.

Pods also have Volumes. Volumes are data disks that live as long as the pods live, and can be used by the containers in that pod. Pods provide a shared namespace for their contents which means that the two containers inside of our example pod can communicate with each other, and they also share the attached volumes.

Pods also share a network namespace. This means that there is one IP Address per pod.

Next, a deeper dive into pods.




student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ cat pods/monolith.yaml
apiVersion: v1
kind: Pod
metadata:
  name: monolith
  labels:
    app: monolith
spec:
  containers:
    - name: monolith
      image: kelseyhightower/monolith:1.0.0
      args:
        - "-http=0.0.0.0:80"
        - "-health=0.0.0.0:81"
        - "-secret=secret"
      ports:
        - name: http
          containerPort: 80
        - name: health
          containerPort: 81
      resources:
        limits:
          cpu: 0.2
          memory: "10Mi"
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl create -f pods/monolith.yaml
pod/monolith created
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl describe pods monolith
Name:             monolith
Namespace:        default
Priority:         0
Service Account:  default
Node:             gke-io-default-pool-04a8c07b-jdlw/10.128.0.3
Start Time:       Tue, 01 Aug 2023 22:10:29 +0000
Labels:           app=monolith
Annotations:      <none>
Status:           Running
IP:               10.68.0.8
IPs:
  IP:  10.68.0.8
Containers:
  monolith:
    Container ID:  containerd://aa34146da6ee526394b1ed295e5b8875e25d25b1913171c28a4b34fed655de25
    Image:         kelseyhightower/monolith:1.0.0
    Image ID:      sha256:980e09dd5c76f726e7369ac2c3aa9528fe3a8c92382b78e97aa54a4a32d3b187
    Ports:         80/TCP, 81/TCP
    Host Ports:    0/TCP, 0/TCP
    Args:
      -http=0.0.0.0:80
      -health=0.0.0.0:81
      -secret=secret
    State:          Running
      Started:      Tue, 01 Aug 2023 22:10:31 +0000
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     200m
      memory:  10Mi
    Requests:
      cpu:        200m
      memory:     10Mi
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-66b96 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  kube-api-access-66b96:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Guaranteed
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  7s    default-scheduler  Successfully assigned default/monolith to gke-io-default-pool-04a8c07b-jdlw
  Normal  Pulling    7s    kubelet            Pulling image "kelseyhightower/monolith:1.0.0"
  Normal  Pulled     5s    kubelet            Successfully pulled image "kelseyhightower/monolith:1.0.0" in 1.669350381s (1.669382561s including waiting)
  Normal  Created    5s    kubelet            Created container monolith
  Normal  Started    5s    kubelet            Started container monolith
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl http://127.0.0.1:10080
{"message":"Hello"}
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl http://127.0.0.1:10080/secure
authorization failed
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl http://127.0.0.1:10080
{"message":"Hello"}
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl http://127.0.0.1:10080/secure
authorization failed
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl -u user http://127.0.0.1:10080/login
Enter host password for user 'user':
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InVzZXJAZXhhbXBsZS5jb20iLCJleHAiOjE2OTExODcxNzAsImlhdCI6MTY5MDkyNzk3MCwiaXNzIjoiYXV0aC5zZXJ2aWNlIiwic3ViIjoidXNlciJ9.-yvt-dX_gLg59w7ZlMiCrZ2CB2jIsttwT-dnlx7LiWE"}
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ TOKEN=$(curl http://127.0.0.1:10080/login -u user|jq -r '.token')
Enter host password for user 'user':
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   222  100   222    0     0    366      0 --:--:-- --:--:-- --:--:--   366
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ echo $TOKEN
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InVzZXJAZXhhbXBsZS5jb20iLCJleHAiOjE2OTExODcxOTcsImlhdCI6MTY5MDkyNzk5NywiaXNzIjoiYXV0aC5zZXJ2aWNlIiwic3ViIjoidXNlciJ9.ygLU2oEgi1z_sQDfytegdECaUUp1iVs44D-Pyk5z2KE
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl -H "Authorization: Bearer $TOKEN" 
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:10080/secure
{"message":"Hello"}
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl logs monolith
2023/08/01 22:10:31 Starting server...
2023/08/01 22:10:31 Health service listening on 0.0.0.0:81
2023/08/01 22:10:31 HTTP service listening on 0.0.0.0:80
127.0.0.1:48664 - - [Tue, 01 Aug 2023 22:10:57 UTC] "GET / HTTP/1.1" curl/7.74.0
127.0.0.1:45580 - - [Tue, 01 Aug 2023 22:12:17 UTC] "GET /secure HTTP/1.1" curl/7.74.0
127.0.0.1:38768 - - [Tue, 01 Aug 2023 22:12:28 UTC] "GET / HTTP/1.1" curl/7.74.0
127.0.0.1:38780 - - [Tue, 01 Aug 2023 22:12:30 UTC] "GET /secure HTTP/1.1" curl/7.74.0
127.0.0.1:51144 - - [Tue, 01 Aug 2023 22:12:50 UTC] "GET /login HTTP/1.1" curl/7.74.0
127.0.0.1:57472 - - [Tue, 01 Aug 2023 22:13:17 UTC] "GET /login HTTP/1.1" curl/7.74.0
127.0.0.1:45450 - - [Tue, 01 Aug 2023 22:13:50 UTC] "GET /secure HTTP/1.1" curl/7.74.0
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl http://127.0.0.1:10080
{"message":"Hello"}
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl http://127.0.0.1:10080
{"message":"Hello"}
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl http://127.0.0.1:10080
{"message":"Hello"}
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ -ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03^C
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl exec monolith --stdin --tty -c monolith -- /bin/sh
/ # 
/ # 
/ # 
/ # ping -c 3 google.com
PING google.com (74.125.70.102): 56 data bytes
64 bytes from 74.125.70.102: seq=0 ttl=114 time=1.465 ms
64 bytes from 74.125.70.102: seq=1 ttl=114 time=1.104 ms
64 bytes from 74.125.70.102: seq=2 ttl=114 time=0.895 ms

--- google.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.895/1.154/1.465 ms
/ # exit
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ cat pods/secure-monolith.yaml
apiVersion: v1
kind: Pod
metadata:
  name: "secure-monolith"
  labels:
    app: monolith
spec:
  containers:
    - name: nginx
      image: "nginx:1.9.14"
      lifecycle:
        preStop:
          exec:
            command: ["/usr/sbin/nginx","-s","quit"]
      volumeMounts:
        - name: "nginx-proxy-conf"
          mountPath: "/etc/nginx/conf.d"
        - name: "tls-certs"
          mountPath: "/etc/tls"
    - name: monolith
      image: "kelseyhightower/monolith:1.0.0"
      ports:
        - name: http
          containerPort: 80
        - name: health
          containerPort: 81
      resources:
        limits:
          cpu: 0.2
          memory: "10Mi"
      livenessProbe:
        httpGet:
          path: /healthz
          port: 81
          scheme: HTTP
        initialDelaySeconds: 5
        periodSeconds: 15
        timeoutSeconds: 5
      readinessProbe:
        httpGet:
          path: /readiness
          port: 81
          scheme: HTTP
        initialDelaySeconds: 5
        timeoutSeconds: 1
  volumes:
    - name: "tls-certs"
      secret:
        secretName: "tls-certs"
    - name: "nginx-proxy-conf"
      configMap:
        name: "nginx-proxy-conf"
        items:
          - key: "proxy.conf"
            path: "proxy.conf"
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl create secret generic tls-certs --from-file tls/
kubectl create configmap nginx-proxy-conf --from-file nginx/proxy.conf
kubectl create -f pods/secure-monolith.yaml
secret/tls-certs created
configmap/nginx-proxy-conf created
pod/secure-monolith created
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ history 10
   25  curl -H "Authorization: Bearer $TOKEN" 
   26  curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:10080/secure
   27  kubectl logs monolith
   28  curl http://127.0.0.1:10080
   29  kubectl exec monolith --stdin --tty -c monolith -- /bin/sh
   30  cat pods/secure-monolith.yaml
   31  kubectl create secret generic tls-certs --from-file tls/
   32  kubectl create configmap nginx-proxy-conf --from-file nginx/proxy.conf
   33  kubectl create -f pods/secure-monolith.yaml
   34  history 10
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
monolith                 1/1     Running   0          9m51s
nginx-79bb7d4b87-6nrqm   1/1     Running   0          12m
secure-monolith          2/2     Running   0          25s
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ ls -l
total 24
-rw-r--r-- 1 student_04_1c515c556d93 student_04_1c515c556d93  283 Aug  1 22:06 cleanup.sh
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 deployments
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 nginx
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 pods
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 services
drwxr-xr-x 2 student_04_1c515c556d93 student_04_1c515c556d93 4096 Aug  1 22:06 tls
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ cd pods
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes/pods (qwiklabs-gcp-03-ef6a7d727fd0)$ ls
healthy-monolith.yaml  monolith.yaml  secure-monolith.yaml
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes/pods (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes/pods (qwiklabs-gcp-03-ef6a7d727fd0)$ cat services/monolith.yaml
cat: services/monolith.yaml: No such file or directory
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes/pods (qwiklabs-gcp-03-ef6a7d727fd0)$ cd ..
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ cat services/monolith.yaml
kind: Service
apiVersion: v1
metadata:
  name: "monolith"
spec:
  selector:
    app: "monolith"
    secure: "enabled"
  ports:
    - protocol: "TCP"
      port: 443
      targetPort: 443
      nodePort: 31000
  type: NodePort
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ ls
cleanup.sh  deployments  nginx  pods  services  tls
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl create -f services/monolith.yaml
service/monolith created
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
monolith                 1/1     Running   0          11m
nginx-79bb7d4b87-6nrqm   1/1     Running   0          14m
secure-monolith          2/2     Running   0          2m31s
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods -o wide
NAME                     READY   STATUS    RESTARTS   AGE     IP          NODE                                NOMINATED NODE   READINESS GATES
monolith                 1/1     Running   0          12m     10.68.0.8   gke-io-default-pool-04a8c07b-jdlw   <none>           <none>
nginx-79bb7d4b87-6nrqm   1/1     Running   0          14m     10.68.0.7   gke-io-default-pool-04a8c07b-jdlw   <none>           <none>
secure-monolith          2/2     Running   0          2m37s   10.68.2.6   gke-io-default-pool-04a8c07b-sw9t   <none>           <none>
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)         AGE
kubernetes   ClusterIP      10.72.0.1      <none>          443/TCP         19m
monolith     NodePort       10.72.15.184   <none>          443:31000/TCP   20s
nginx        LoadBalancer   10.72.14.139   34.68.183.219   80:30113/TCP    14m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc -o wide
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)         AGE   SELECTOR
kubernetes   ClusterIP      10.72.0.1      <none>          443/TCP         19m   <none>
monolith     NodePort       10.72.15.184   <none>          443:31000/TCP   24s   app=monolith,secure=enabled
nginx        LoadBalancer   10.72.14.139   34.68.183.219   80:30113/TCP    14m   app=nginx
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ gcloud compute firewall-rules create allow-monolith-nodeport \
  --allow=tcp:31000
Creating firewall...working..Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-ef6a7d727fd0/global/firewalls/allow-monolith-nodeport].                                                              
Creating firewall...done.                                                                                                                                                                                                 
NAME: allow-monolith-nodeport
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 1000
ALLOW: tcp:31000
DENY: 
DISABLED: False
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ gcloud compute instances list
NAME: gke-io-default-pool-04a8c07b-jdlw
ZONE: us-central1-b
MACHINE_TYPE: e2-medium
PREEMPTIBLE: 
INTERNAL_IP: 10.128.0.3
EXTERNAL_IP: 34.133.126.70
STATUS: RUNNING

NAME: gke-io-default-pool-04a8c07b-sw9t
ZONE: us-central1-b
MACHINE_TYPE: e2-medium
PREEMPTIBLE: 
INTERNAL_IP: 10.128.0.5
EXTERNAL_IP: 104.198.214.27
STATUS: RUNNING

NAME: gke-io-default-pool-04a8c07b-z3d9
ZONE: us-central1-b
MACHINE_TYPE: e2-medium
PREEMPTIBLE: 
INTERNAL_IP: 10.128.0.4
EXTERNAL_IP: 34.29.11.85
STATUS: RUNNING
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)         AGE
kubernetes   ClusterIP      10.72.0.1      <none>          443/TCP         29m
monolith     NodePort       10.72.15.184   <none>          443:31000/TCP   10m
nginx        LoadBalancer   10.72.14.139   34.68.183.219   80:30113/TCP    24m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ curl -k https://10.72.15.184:31000



^C
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)         AGE
kubernetes   ClusterIP      10.72.0.1      <none>          443/TCP         32m
monolith     NodePort       10.72.15.184   <none>          443:31000/TCP   13m
nginx        LoadBalancer   10.72.14.139   34.68.183.219   80:30113/TCP    27m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl describe service monolith
Name:                     monolith
Namespace:                default
Labels:                   <none>
Annotations:              cloud.google.com/neg: {"ingress":true}
Selector:                 app=monolith,secure=enabled
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.72.15.184
IPs:                      10.72.15.184
Port:                     <unset>  443/TCP
TargetPort:               443/TCP
NodePort:                 <unset>  31000/TCP
Endpoints:                <none>
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
monolith                 1/1     Running   0          26m
nginx-79bb7d4b87-6nrqm   1/1     Running   0          28m
secure-monolith          2/2     Running   0          16m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods -o wide
NAME                     READY   STATUS    RESTARTS   AGE   IP          NODE                                NOMINATED NODE   READINESS GATES
monolith                 1/1     Running   0          26m   10.68.0.8   gke-io-default-pool-04a8c07b-jdlw   <none>           <none>
nginx-79bb7d4b87-6nrqm   1/1     Running   0          28m   10.68.0.7   gke-io-default-pool-04a8c07b-jdlw   <none>           <none>
secure-monolith          2/2     Running   0          16m   10.68.2.6   gke-io-default-pool-04a8c07b-sw9t   <none>           <none>
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc -o wide
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)         AGE   SELECTOR
kubernetes   ClusterIP      10.72.0.1      <none>          443/TCP         33m   <none>
monolith     NodePort       10.72.15.184   <none>          443:31000/TCP   14m   app=monolith,secure=enabled
nginx        LoadBalancer   10.72.14.139   34.68.183.219   80:30113/TCP    28m   app=nginx
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods -l "app=monolith"
NAME              READY   STATUS    RESTARTS   AGE
monolith          1/1     Running   0          27m
secure-monolith   2/2     Running   0          18m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
secure-monolith   2/2     Running   0          18m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
-bash: secure-monolith: command not found
-bash: syntax error near unexpected token `qwiklabs-gcp-03-ef6a7d727fd0'
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods -l "app=monolith,secure=enabled"
No resources found in default namespace.
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl label pods secure-monolith 'secure=enabled'
kubectl get pods secure-monolith --show-labels
pod/secure-monolith labeled
NAME              READY   STATUS    RESTARTS   AGE   LABELS
secure-monolith   2/2     Running   0          18m   app=monolith,secure=enabled
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods -l "app=monolith"
NAME              READY   STATUS    RESTARTS   AGE
monolith          1/1     Running   0          28m
secure-monolith   2/2     Running   0          19m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
monolith                 1/1     Running   0          28m
nginx-79bb7d4b87-6nrqm   1/1     Running   0          31m
secure-monolith          2/2     Running   0          19m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl describe services monolith | grep Endpoints
Endpoints:                10.68.2.6:443
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ gcloud compute instances list
curl -k https://10.68.2.6:31000
NAME: gke-io-default-pool-04a8c07b-jdlw
ZONE: us-central1-b
MACHINE_TYPE: e2-medium
PREEMPTIBLE: 
INTERNAL_IP: 10.128.0.3
EXTERNAL_IP: 34.133.126.70
STATUS: RUNNING

NAME: gke-io-default-pool-04a8c07b-sw9t
ZONE: us-central1-b
MACHINE_TYPE: e2-medium
PREEMPTIBLE: 
INTERNAL_IP: 10.128.0.5
EXTERNAL_IP: 104.198.214.27
STATUS: RUNNING

NAME: gke-io-default-pool-04a8c07b-z3d9
ZONE: us-central1-b
MACHINE_TYPE: e2-medium
PREEMPTIBLE: 
INTERNAL_IP: 10.128.0.4
EXTERNAL_IP: 34.29.11.85
STATUS: RUNNING

'

Task 9. Deploying applications with Kubernetes

The goal of this lab is to get you ready for scaling and managing containers in production. That's where Deployments come in. Deployments are a declarative way to ensure that the number of Pods running is equal to the desired number of Pods, specified by the user.

Deployments diagram includes nodes one, two, and three. app: hello. replicas: 3The main benefit of Deployments is in abstracting away the low level details of managing Pods. Behind the scenes Deployments use Replica Sets to manage starting and stopping the Pods. If Pods need to be updated or scaled, the Deployment will handle that. Deployment also handles restarting Pods if they happen to go down for some reason.

Look at a quick example:

Deployments diagram

Pods are tied to the lifetime of the Node they are created on. In the example above, Node3 went down (taking a Pod with it). Instead of manually creating a new Pod and finding a Node for it, your Deployment created a new Pod and started it on Node2.

That's pretty cool!

It's time to combine everything you learned about Pods and Services to break up the monolith application into smaller Services using Deployments.

^C
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ cat deployments/auth.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth
spec:
  selector:
    matchLabels:
      app: auth
  replicas: 1
  template:
    metadata:
      labels:
        app: auth
        track: stable
    spec:
      containers:
        - name: auth
          image: "kelseyhightower/auth:2.0.0"
          ports:
            - name: http
              containerPort: 80
            - name: health
              containerPort: 81
          resources:
            limits:
              cpu: 0.2
              memory: "10Mi"
          livenessProbe:
            httpGet:
              path: /healthz
              port: 81
              scheme: HTTP
            initialDelaySeconds: 5
            periodSeconds: 15
            timeoutSeconds: 5
          readinessProbe:
            httpGet:
              path: /readiness
              port: 81
              scheme: HTTP
            initialDelaySeconds: 5
            timeoutSeconds: 1
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl create -f deployments/auth.yaml
deployment.apps/auth created
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get deployments
NAME    READY   UP-TO-DATE   AVAILABLE   AGE
auth    1/1     1            1           15s
nginx   1/1     1            1           35m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
auth-8dcc5fdf8-rq52j     1/1     Running   0          20s
monolith                 1/1     Running   0          32m
nginx-79bb7d4b87-6nrqm   1/1     Running   0          35m
secure-monolith          2/2     Running   0          22m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svcs
error: the server doesn't have a resource type "svcs"
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)         AGE
kubernetes   ClusterIP      10.72.0.1      <none>          443/TCP         39m
monolith     NodePort       10.72.15.184   <none>          443:31000/TCP   20m
nginx        LoadBalancer   10.72.14.139   34.68.183.219   80:30113/TCP    34m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl create -f services/auth.yaml
service/auth created
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)         AGE
auth         ClusterIP      10.72.6.13     <none>          80/TCP          3s
kubernetes   ClusterIP      10.72.0.1      <none>          443/TCP         39m
monolith     NodePort       10.72.15.184   <none>          443:31000/TCP   20m
nginx        LoadBalancer   10.72.14.139   34.68.183.219   80:30113/TCP    35m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl create -f deployments/hello.yaml
kubectl create -f services/hello.yaml
deployment.apps/hello created
service/hello created
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
auth-8dcc5fdf8-rq52j     1/1     Running   0          67s
hello-64fc59fc76-4b5gj   0/1     Running   0          10s
hello-64fc59fc76-nnrrn   0/1     Running   0          10s
hello-64fc59fc76-tbgtb   0/1     Running   0          10s
monolith                 1/1     Running   0          33m
nginx-79bb7d4b87-6nrqm   1/1     Running   0          35m
secure-monolith          2/2     Running   0          23m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get deployments
NAME    READY   UP-TO-DATE   AVAILABLE   AGE
auth    1/1     1            1           76s
hello   3/3     3            3           18s
nginx   1/1     1            1           36m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)         AGE
auth         ClusterIP      10.72.6.13     <none>          80/TCP          42s
hello        ClusterIP      10.72.9.114    <none>          80/TCP          19s
kubernetes   ClusterIP      10.72.0.1      <none>          443/TCP         40m
monolith     NodePort       10.72.15.184   <none>          443:31000/TCP   21m
nginx        LoadBalancer   10.72.14.139   34.68.183.219   80:30113/TCP    35m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl create configmap nginx-frontend-conf --from-file=nginx/frontend.conf
kubectl create -f deployments/frontend.yaml
kubectl create -f services/frontend.yaml
configmap/nginx-frontend-conf created
deployment.apps/frontend created
service/frontend created
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ 
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-gcp-03-ef6a7d727fd0)$ kubectl get deployments
NAME       READY   UP-TO-DATE   AVAILABLE   AGE
auth       1/1     1            1           104s
frontend   0/1     1            0           6s
hello      3/3     3            3           46s
nginx      1/1     1            1           36m
student_04_1c515c556d93@cloudshell:~/orchestrate-with-kubernetes/kubernetes (qwiklabs-g

No comments:

Post a Comment

AppEngine - Python

tudent_04_347b5286260a@cloudshell:~/python-docs-samples/appengine/standard_python3/hello_world (qwiklabs-gcp-00-88834e0beca1)$ sudo apt upda...