Introduction what is container and how to use it. staring from the comparison to virtual machine and also show how to use the persistent storage and port mapping in containers.
In the last part, shows what is kubernetes and what kind of problems kubernetes want to solve and how it solves.
12. Relationship between VMs/Containers
✖Containers Are More Agile then VMs
✖Containers Enable Hybrid and Multi-
Cloud Adoption
✖Integrate Containers with Your Existing
IT Process
✖Containers Save on VM Licensing
✖What About Bare Metal
✖What About Security
https://blog.docker.com/2018/08/containers-replacing-
virtual-machines/
20. Connect to other container.
✖ping 172.18.0.3
✖Ping 172.18.0.2
✖Ping 172.18.0.1
✖redis-cli -h 172.18.0.2
○ Connect to container directly
✖redis-cli -h 172.18.0.1
○ Connect to host and forward by iptables
21. Storage
✖Mount data from outside
○ -v source:dest
✖ sudo docker run -d --name test
-v ~/kubeDemo/:/kubeDemo hwchiu/netutils
✖sudo docker exec –it test bash
○ ls /kubeDemo
22. How to use docker
✖Prepare the image you want
✖Run container from the image
✖Connect to container by network
✖Mount directory/file
60. Before kubernetes
✖Google has been running
containerized workloads in
production.
○ Virtually everything runs as a container.
✖Borg: The predecessor to Kubernetes
○ Long-rumored internal container-
oriented cluster-management system.
○ Pod
○ Services
○ Label
https://kubernetes.io/blog/2015/04/borg-predecessor-to-
kubernetes/
61. Kubernetes architecture
Users Control Plane Nodes
https://www.flaticon.com/free-icon/boy_145867
API Server
Scheduler
Controller
Node (VM)
Node (Bare Metal)
Node (Container)
CLI DISPATCH
62. Kubernetes architecture
Users Control Plane Nodes
https://www.flaticon.com/free-icon/boy_145867
API Server
Scheduler
Controller
Node (VM)
Node (Bare Metal)
Node (Container)
CLI DISPATCH
I want to deploy a container
63. Kubernetes architecture
Users Control Plane Nodes
https://www.flaticon.com/free-icon/boy_145867
API Server
Scheduler
Controller
Node (VM)
Node (Bare Metal)
Node (Container)
CLI DISPATCH
Find a target node
64. Kubernetes architecture
Users Control Plane Nodes
https://www.flaticon.com/free-icon/boy_145867
API Server
Scheduler
Controller
Node (VM)
Node (Bare Metal)
Node (Container)
CLI DISPATCH
Dispatch Container
65. Kubernetes architecture
Users Control Plane Nodes
https://www.flaticon.com/free-icon/boy_145867
API Server
Scheduler
Controller
Node (VM)
Node (Bare Metal)
Node (Container)
CLI DISPATCH
Running Container
74. Pod
✖cd kubeDemo/services/application
✖kubectl apply –f ubuntu.yml
✖kubectl get pods –o wide
○ Get the IP address of that pod.
✖kubectl describe pod ubuntu
○ Show pod detail
✖kubectl exec –it ubuntu bash
○ Like `docker exec …`
✖kubectl delete pod ubuntu
○ kubectl get pods
75. replica Set
✖Maintain a stable set of replica Pods
running at any given time.
✖Guarantee the availability of a
specified number of identical Pods.
79. Deployment
- replicas: 3
- version: v1
Replica Set
replica=3
Pod Pod Pod
Deployment
Deployment
- replicas: 0
- version: v2
Replica Set
replica=0
Deployment
80. Deployment
- replicas: 3
- version: v1
Replica Set
replica=3
Pod Pod Pod
Deployment
Deployment
- replicas: 1
- version: v2
Replica Set
replica=1
Pod
Deployment
81. Deployment
- replicas: 2
- version: v1
Replica Set
replica=2
Pod Pod
Deployment
Deployment
- replicas: 1
- version: v2
Replica Set
replica=1
Pod
Deployment
82. Deployment
- replicas: 2
- version: v1
Replica Set
replica=3
Pod Pod
Deployment
Deployment
- replicas: 2
- version: v2
Replica Set
replica=2
Pod Pod
Deployment
83. Deployment
- replicas: 1
- version: v1
Replica Set
replica=1
Pod
Deployment
Deployment
- replicas: 2
- version: v2
Replica Set
replica=2
Pod Pod
Deployment
84. Deployment
- replicas: 1
- version: v1
Replica Set
replica=1
Pod
Deployment
Deployment
- replicas: 3
- version: v2
Replica Set
replica=3
Pod Pod Pod
Deployment
85. Deployment
- replicas: 0
- version: v1
Replica Set
replica=0
Deployment
Deployment
- replicas: 3
- version: v2
Replica Set
replica=3
Pod Pod Pod
Deployment
86. Deployment
✖cd kubeDemo/services/deployment
✖kubectl apply –f redis.yml
✖kubectl get pods –o wide
○ Get the IP address of all pod.
✖kubectl exec –it redis-xxx bash
○ Like `docker exec …`
✖kubectl delete pod redis-xxxx
○ kubectl get pods
✖kubectl get pods –o wide
○ Get the IP address of all pod.
88. network
✖Network Connectivity
○ Container to Container (Same Node)
○ Container to Container (Cross Node)
✖Service
○ Wan to Container
✖Ingress
○ Wan to Container
✖Network Policy
89. Network connectivity
✖Container Network Plugin (CNI)
✖Container to Container (Same Node)
○ Simplest approach is bridge mode
○ Same as Docker default network
✖Container to Container (Cross Node)
○ Overlay Network (VXLAN/GRE)
○ L3 Routing
○ … etc
90. Pod network
✖Group of Containers share same
network environment
✖Communicate by localhost
○ Use same IP address
○ Port conflict
✖How does it works ?
103. Service
✖Application to Service
○ We use the DNS to access the service.
○ $(service).$(namespace).cluster.local
✖Service to Pods
○ Service maintains all IP addresses of all
Pods.
○ We call it endpoints
120. Summary
✖Kubernetes doesn’t provide any
storage function.
✖It rely on backend storage provider.
✖Choose a proper storage to meet your
requirement
✖Learn the concept/knowledge about
storage