VMware introduced a LOT of new stuffs in their latest version of vSphere 7. One of the most important of which, is probably the introduction of 'vSphere with Kubernetes'. This consist of Kubernetes runtime that can be deployed everywhere: on-prem, public cloud and edge. This is an area which is new to me and triggered me to study further. A summary of the basic concepts as below:
Containers
Complete isolated environments
Can have it's own processes, network, mounts
Unlike VMs, containers shares the same OS kernels
There are many types of containers and docker utilities LXC containers
Images: Templates used to create 1 or more containers
Operating system
Consist of the OS kernel + software
OS kernel - which interacts with the underlying hardware
Software - which makes the OS unique
Docker
Docker can run any flavour of OS, so long as they are on the same OS kernel (Eg. Linux, Ubuntu)
Unlike hypervisor, docker is not intended to virtualise different OS and kernels on same hardware, but to containerise application
A lot of application vendors have their apps containerised on Docker hub, Docker store
Containers vs Virtual machine
A VM higher overhead of hardware
A VM has Longer boot up time
A VM has complete isolation; Containers have shared resources (ie. kernel)
A VM can have different OS on same host. Containers must share the same OS kernel on the same host
Kubernetes
Kubernetes is a container orchestrator - Automatically deploy and orchestrate the connectivity between different containers, scaling up and down of containers base on load
Supported on all public cloud providers
Other eg. Docker swarm, MESOS
Basic concepts of Kubernetes
1. Nodes (Minions)
Physical or virtual machine which K8 is installed
2. Cluster
A cluster of nodes grouped together
3. Worker nodes:
Nodes which contain containers
Contains container runtime. Eg. Docker
Contains Kubelet agent
4. Master nodes
A node with K8 installed as master
Responsible of orchestration of the other nodes (eg. management of cluster, Failover, orchestration of containers)
Contains Kube apiserver
Contains etcd
Contains controller
Contains scheduler
K8 Components
API server - front end server for users
etcd - Store all data used to manage the cluster
Scheduler - Distributing work or containers across multiple nodes
Controller - Brain behind orchestration. Eg. Responses when a node goes down and make decisions to bring up new node
Container runtime - Underlying software used to run containers. Eg. Docker
Kubelet - Agent that runs on each node in the cluster. Make sure that containers are running in the node as expected
Kubectl
A command line tool used to deploy and manage application in a K8 cluster
Eg. Get cluster info, status of nodes in cluster
Kubectl run - deploy an application in the cluster
Kubectl cluster-info - view info about the cluster
Kubectl get nodes - list all nodes in the cluster
Eg. of solutions to setup K8 locally
Minikube
MicroK8s
Kubeadm
POD
Smallest object u can create in K8
Has it’s own IP address
An encapsulated container, which contains a single instance of an application
Usually has a 1 - 1 relationship with container, Unless the container are different in nature (eg. Helper containers), which has a close relationship and supports the other container
Containers in same pod will share the same storage, network and be managed together (ie. created together or destroyed together)
Command for POD
Kubectl run nginx —image=xxx - deploys a docker container by creating a POD and deploys an instance of xxx docker image (downloaded from docker hub depository)
Kubectl get pods - see the list of pods in the cluster
Kubectl describe pods - display more info of pods
Kubectl get pods -o wide - see the list of pods in the cluster, with IP and node info
YAML
Kubernetes uses YAML for the creation of objects. ie. PODS, replicas deployments, etc
Kubernetes definition file always contains 4 top level fields
apiVersion: version of K8 api that you are using to create the object. eg. V1, apps/v1
kind: kind of object that you are creating. ie. Pod, replicaSet, Service, deployment
metadata: Data above the object. ie. name, labels, etc. It is in the form of a dictionary (Parent, child, grand child, etc)
spec: Additional info to K8 pertaining to the object which you are creating. Format differs according to the type of object which you are creating
Examples of YAML commands:
kubectl create -f pod-definition.yml - to create the pod
Kubectl get pods - to see the list of pods available
Kubectl describe pod myapp-pod - to see the detail info of the pod
"What do you think?"
Let me know if you think there are any important/useful details I have missed in the above write up.
Comments