Session ID: Run Kubernetes on VMware [KUB2073WER]
Brief description:
Whether you are a VI admin working with vSphere, a DevOps engineer or a Developer you might have seen requests to work with Containers. If you are already working with VMware solutions in your enterprise wouldn’t it be great to leverage those solutions to work on Containers? What does it mean working with Containers? It can mean different things depending on where in the cycle are you interacting with them ( infrastructure/Platform/Development etc.)In this session, we start with the basics of containers and Kubernetes and go all the way to teach how to implement them within your enterprise. Why do we need an orchestrator like Kubernetes? What are the different elements in Kubernetes and how are applications deployed via Kubernetes? How is application High Availability handled? etc. The workshop will include labs and live exercises.
Speakers:
Boskey Savla, Technical Product Line Marketing Manager, VMware
Cody deArkland , Technical Product Line Marketing Manager, VMware

Workshop schedule has been divided into 4 main steps conducted by Boskey and Cody
- Introduction to Kubernetes : Basically what is and how it works
- Labs = We had dedicated lab environment running PKS
- Introduction to Kubernetes running on vSphere
- Labs

In order to receive access to dedicated lab, we have been invited to VMware Cloud PKS service (Public available for trial/purchase).

Once our login has been accepted, we had our first look into the interface of PKS
Next Step – Let’s do some action and hands on!
Thanks to Boskey and Cody we just had to copy and paste some kubctl commands
Source: https://github.com/Boskey/run_kubernetes_with_vmware/wiki

Creating new Deployment for PlaneSpotter Application ( Load Balancer + Web + App + DB )
One of the coolest features I really liked was the consistency within the deployment (no idea about all the yaml file configurations), but keeping the WEB as 2 nodes minimum, even after manual deletion = it keeps creating automatically the minimum requirement.
Example:
Deleting one of the frontend servers + automatically got a 2nd one deployed (Check different IDs allocated on name)
Web Service up and running (Including external load balancer <public ip/url>)

Full Code Steps in order to reproduce in your environment.
<Please not the Cluster and Names will be differently>
C:\pks>vke account login --organization ba18adce-f745-4799-8db1-14e021994fd6 --refresh-token cfz491shJEr6Za9Zi5L63EqUu6O0JuqvchSMdme5kX4LG02IbiULOq9sYnlpz0f1
Login successful
C:\pks>vke folder set SharedFolder
Folder set to 'SharedFolder'
C:\pks>vke project set SharedProject
Project set to 'SharedProject'
C:\pks>vke cluster merge-kubectl-auth runk8-cluster148
merge-kubectl-auth has been deprecated. Please use 'vke cluster auth setup' instead.
Auth configuration written to kubectl file(s) for cluster runk8-cluster148
Current Context set to runk8-cluster148-context
C:\pks>kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-test-7fcfb6488c-gmcj6 1/1 Running 0 20h
C:\pks>kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 21h
C:\pks>kubectl create ns planespotter
namespace/planespotter created
C:\pks>kubectl config set-context kubernetes-admin@kubernetes --namespace planespotter
Context "kubernetes-admin@kubernetes" created.
C:\pks>kubectl get namespaces
NAME STATUS AGE
default Active 21h
kube-public Active 21h
kube-system Active 21h
planespotter Active 14s
vke-system Active 21h
C:\pks>kubectl create -f https://raw.githubusercontent.com/Boskey/planespotter/master/kubernetes/mysql_claim.yaml
persistentvolumeclaim/mysql-claim created
C:\pks>kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-d00d73f9-ff0b-11e9-9c25-0211dfb8ed0f 2Gi RWO Delete Bound planespotter/mysql-claim default 2m17s
C:\pks>kubectl create -f https://raw.githubusercontent.com/Boskey/planespotter/master/kubernetes/mysql_pod.yaml
service/mysql created
statefulset.apps/mysql created
configmap/mysql-config-map created
configmap/mysql-start-map created
C:\pks>kubectl get pods --namespace planespotter
NAME READY STATUS RESTARTS AGE
mysql-0 0/1 ContainerCreating 0 4s
C:\pks>kubectl create -f https://raw.githubusercontent.com/Boskey/planespotter/master/kubernetes/app-server-deployment_all_k8s.yaml
deployment.apps/planespotter-app created
configmap/planespotter-app-cfg created
service/planespotter-svc created
C:\pks>kubectl create -f https://raw.githubusercontent.com/Boskey/planespotter/master/kubernetes/frontend-deployment_all_k8s.yaml
deployment.apps/planespotter-frontend created
service/planespotter-frontend created
ingress.extensions/planespotter-frontend created
C:\pks>kubectl create -f https://raw.githubusercontent.com/Boskey/planespotter/master/kubernetes/redis_and_adsb_sync_all_k8s.yaml
deployment.extensions/redis-server created
service/redis-server created
deployment.apps/adsb-sync created
configmap/adsb-sync-cfg created
C:\pks>kubectl get pods --namespace planespotter
NAME READY STATUS RESTARTS AGE
adsb-sync-5dbb876bc9-chhpl 0/1 ContainerCreating 0 4s
mysql-0 1/1 Running 0 79s
planespotter-app-7697878684-5g92k 1/1 Running 0 22s
planespotter-app-7697878684-s75tf 1/1 Running 0 22s
planespotter-frontend-5cfcc7fff5-7qxj4 1/1 Running 0 9s
planespotter-frontend-5cfcc7fff5-pdtl2 1/1 Running 0 9s
redis-server-585bbbb6cf-wm5sm 0/1 ContainerCreating 0 4s
C:\pks>kubectl get services --namespace planespotter
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mysql ClusterIP None <none> 3306/TCP 98s
planespotter-frontend ClusterIP 10.0.0.9 <none> 80/TCP 28s
planespotter-svc ClusterIP 10.0.0.212 <none> 80/TCP 41s
redis-server ClusterIP 10.0.0.162 <none> 6379/TCP 23s
C:\pks>kubectl expose deployment planespotter-frontend --name=planespotter-frontend-lb-runk8-cluster148 --port=80 --target-port=80 --type=LoadBalancer --namespace=planespotter
service/planespotter-frontend-lb-runk8-cluster148 exposed
C:\pks>kubectl get services --namespace planespotter
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mysql ClusterIP None <none> 3306/TCP 6m51s
planespotter-frontend ClusterIP 10.0.0.9 <none> 80/TCP 5m41s
planespotter-frontend-lb-runk8-cluster148 LoadBalancer 10.0.0.250 <pending> 80:30423/TCP 11s
planespotter-svc ClusterIP 10.0.0.212 <none> 80/TCP 5m54s
redis-server ClusterIP 10.0.0.162 <none> 6379/TCP 5m36s
C:\pks>kubectl get services --namespace planespotter
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mysql ClusterIP None <none> 3306/TCP 8m22s
planespotter-frontend ClusterIP 10.0.0.9 <none> 80/TCP 7m12s
planespotter-frontend-lb-runk8-cluster148 LoadBalancer 10.0.0.250 planespotter-frontend-lb-runk8-cluster148.runk8-cluster148-6d5dbc8c-fe57-11e9-a36b-120e5613a14e.ba18adce-f745-4799-8db1-14e021994fd6.vke-user.com 80:30423/TCP 102s
planespotter-svc ClusterIP 10.0.0.212 <none> 80/TCP 7m25s
redis-server ClusterIP 10.0.0.162 <none> 6379/TCP 7m7s
C:\pks>kubectl get svc planespotter-frontend-lb-runk8-cluster148 -o wide --namespace planespotter
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
planespotter-frontend-lb-runk8-cluster148 LoadBalancer 10.0.0.250 planespotter-frontend-lb-runk8-cluster148.runk8-cluster148-6d5dbc8c-fe57-11e9-a36b-120e5613a14e.ba18adce-f745-4799-8db1-14e021994fd6.vke-user.com 80:30423/TCP 2m13s app=planespotter-frontend
C:\pks>kubectl get pods -n planespotter
NAME READY STATUS RESTARTS AGE
adsb-sync-5dbb876bc9-chhpl 0/1 CrashLoopBackOff 6 9m55s
mysql-0 1/1 Running 0 11m
planespotter-app-7697878684-5g92k 1/1 Running 0 10m
planespotter-app-7697878684-s75tf 1/1 Running 0 10m
planespotter-frontend-5cfcc7fff5-7qxj4 1/1 Running 0 10m
planespotter-frontend-5cfcc7fff5-pdtl2 1/1 Running 0 10m
redis-server-585bbbb6cf-wm5sm 1/1 Running 0 9m55s
C:\pks>kubectl delete pod planespotter-frontend-5cfcc7fff5-7qxj4 -n planespotter
pod "planespotter-frontend-5cfcc7fff5-7qxj4" deleted
C:\pks>kubectl get pods -n planespotter
NAME READY STATUS RESTARTS AGE
adsb-sync-5dbb876bc9-chhpl 0/1 CrashLoopBackOff 7 13m
mysql-0 1/1 Running 0 14m
planespotter-app-7697878684-5g92k 1/1 Running 0 13m
planespotter-app-7697878684-s75tf 1/1 Running 0 13m
planespotter-frontend-5cfcc7fff5-pdtl2 1/1 Running 0 13m
planespotter-frontend-5cfcc7fff5-rnjct 1/1 Running 0 20s
redis-server-585bbbb6cf-wm5sm 1/1 Running 0 13m
See you on next post!
#BlogPass #VMWare #vmworld #vRA4U #vExpert #vCommunity