What is Kubernetes ● Container orchestration system created by Google and released on 2014 ○ Google uses Borg (Kubernetes ancestor) internally since 2003 ○ Google deploys billions of containers every week ● Kubernetes run containerized applications in the cluster ● Features: ○ Automated rollouts and rollbacks ○ Self-healing ○ Horizontal scaling ○ etc. Kubernetes - https://kubernetes.io/
Basic Kubernetes objects ● Node: represents single master/worker nodes ● Pod: a minimum manage unit in the Kubernetes cluster ● Deployment: manages one or more Pods across the Kubernetes cluster ● Service: expose/publish the Deployment
Node ● Node represents single master/worker nodes ● 4 Nodes in the diagram ○ 1 control-plane Node ○ 3 worker Nodes ● Node hold information about each node ○ CPU, memory, GPU, etc.
Play with Kubernetes ● Play with Kubernetes https://labs.play-with-k8s.com/ ● You can create a temporary Kubernetes cluster for learning ● Expires at 4 hours later ● Similar service: ○ Kubernetes Playground | Katacoda https://www.katacoda.com/courses/kub ernetes/playground
Hands-on 1: Create Kubernetes cluster 5. Check Nodes status # Get a node list [node1 ~]$ kubectl get node NAME STATUS ROLES AGE VERSION node1 Ready control-plane,master 22m v1.20.1 node2 Ready 21m v1.20.1 # Show the detail information [node1 ~]$ kubectl describe node/node1 ...
Pod ● Pod is a minimum manage unit in the Kubernetes cluster ● Contains one (or more) container inside a Pod ● Run application process in the container ● For example: ○ Nginx container ○ PostgreSQL container ○ Containerized API server application ○ etc. Nginx container
Hands-on 2: Create Pod # Create a Pod [node1 ~]$ k apply -f nginx-pod.yaml pod/nginx created # Check the Pod [node1 ~]$ kubectl get pod NAME READY STATUS RESTARTS AGE nginx 1/1 Running 0 37m # Where is the Pod [node1 ~]$ kubectl get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx 1/1 Running 0 34m 10.5.1.4 node2
Deployment ● Deployment manages one or more Pods across the Kubernetes cluster ● Can keep the number of replicas (auto-recovery) ● Rolling update Nginx Nginx Nginx
● Deployment creates and updates Pods across the Kubernetes cluster (via ReplicaSet object) ● Can keep the number of replicas (auto-recovery) ● Realize rolling update Deployment Nginx Nginx Nginx
Hands-on 3: Create Deployment # Create a Deployment [node1 ~]$ k apply -f web-deploy.yaml deployment.apps/web created # Check the Deployment and Pod created [node1 ~]$ k get deploy,pod -o wide NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR deployment.apps/web 1/1 1 1 96s nginx nginx:latest app=web NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES pod/web-86cd4d65b9-fjbgr 1/1 Running 0 96s 10.5.1.6 node2
Kubernetes website ● Many information ○ Concepts, Tasks, Tutorials, References ● Website: https://k8s.io ● Maintained by Kubernetes community & developers at #sig-docs ● Japanese translation at #sig-docs-ja Kubernetes Website - https://kubernetes.io/ja/
GKE: Google Kubernetes Engine ● Full-managed Kubernetes cluster provided by Google Cloud ○ Control-plane is fully managed ● GKE Autopilot mode is introduced on February 2021 ○ Worker nodes are also fully managed Building the future with Google Kubernetes Engine | Google Cloud Blog https://cloud.google.com/blog/products/containers-kubernetes/building-t he-future-with-google-kubernetes-engine
References ● Kubernetes Website - https://kubernetes.io/ ● Play with Kubernetes - https://labs.play-with-k8s.com/ ● Building the future with Google Kubernetes Engine | Google Cloud Blog - https://cloud.google.com/blog/products/containers-kubernetes/building-t he-future-with-google-kubernetes-engine ● Icon deck: icono-k8s-0.3 - Google Slides - https://docs.google.com/presentation/d/15h_MHjR2fzXIiGZniUdHok_FP0 7u1L8MAX5cN1r0j4U/edit#slide=id.g4cac41f932_1_94
Deploy WordPress & MySQL with Persistent Volume ? Example: Deploying WordPress and MySQL with Persistent Volumes | Kubernetes - https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-per sistent-volume/