Kubernetes is an open-source container management also known as container orchestration tool for automating software deployment, scaling, and management.
Orchestration enables developers to easily build containerized applications and services, as well as scale, schedule and monitor those containers.
Nodes are physical or virtual machine in which kubernetes is installed.
Cluster is group of nodes, if one node fails we have our application accessible from other nodes.
Master is other node in which kubernetes is installed and it manages other nodes
- API Server
- etcd
- kubelet
- Container Runtime
- Controller
- Scheduler
Master has kube-apiserver installed and nodes have kubelet installed (Kubelet is an agent which make sure nodes are healthy) which provides information to master which stores information in etcd (key value storage)
Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node.
- Download kubectl and minikube to start using minikube
A Pod is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers.
Replication Controller used for high availability, it ensures that a specified number of pod replicas are running at any one time. It also helps load balancing and scaling when demand increases.
ReplicaSets replaced replication controllers. A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time.
kubectl create -f deployment.yml
kubectl get deployments
kubectl set image deployment/fitness-app mysql=mysql:8.0
kubectl rollout status deployment/fitness-app
kubectl rollout history deployment/fitness-app
kubectl rollout undo deployment/fitness-app
Kubectl is a Command line tool for communicating with a Kubernetes cluster.
kubectl version
kubectl get nodes
kubectl run mysql --image mysql
kubectl get pods
kubectl describe pod mysql
kubectl get pods -o wide
kubectl create -f pod-definition.yml
kubectl delete pod pod-name
kubectl edit pod pod-name
Kubernetes uses yml file as an input to create pods, replicas, deployments, services and so on,
The yml files contain four top level fields-
- apiVersion: Depending on what we need to create use apiVersion, for creating pods use version v1
- kind: Type of object we want to create such as Pod
- metadata: Data about the object like name, labels and app.
- spec: Specification
kubectl create -f replicaset.yml
kubectl get replicaset
kubectl delete replicaset replicaset-name
kubectl replace -f replicaset.yml
kubectl scale -replicas=6 -f replicaset.yml