Kubernetes
Kubernetes
================================================
Class:-001
Introduction:
- Kubernetes is Container Orchestration Software/Engine.
- Responsibilities include Container Deployment,
- Scaling & descaling of container
- Container load balancing.
- Kubernetes is not a replacement for docker.
- Open Source Software.
- Kubernetes V1.0 was released on July-2015.
- Current version of Kubernetes is V1.24.
Features:
- Automated Scheduling
- Self-Healing Capabilities
- Automated rollout and rollback
- Horizantal and Load balancing
- Service Discovery & Load balancing
- Storage Orchestration.
Kubernetes Architecture:
Cluster --- It's a group of a machine [ Master machine + worker node ]
API Server:-
- kubectl Api server interact with APIs, its a frentend of the kuberntes control plane.
- like ......If i want to deploy, remove & update.
ETCD:-
- It's key value data store (Database).
- Kubernetes will maintain all the cluster information like....
- Node information,Pods information,Services information,Volume information
- It persists the information ETCD (Save the information in ETCD).
Scheduler:
- Scheduler will schedule un-Scheduled PODS in nodes with help of kubelet.
- Based on the resource availability.
kubelet:
- kubelet is the primary node agent.
- Runs on each nodes and ensure that containers are running healthy.
- kubelet interact with container runtime to create the containers.
Controll Manager:
- In the backend it will manage the pods that are running healthy.
- Some of the Control are,
- Node Controller
- Replication Controller
- End Point Controller
Class:-002
NameSpaces:
- NameSpace is like a virtual cluster inside your k8's cluster.
- Cluster inside the cluster.
- We have multiple NameSpace inside our K8's cluster.
- They are logically isolated from each other.
- Using this Namespace concept we can place our application into that namespace.
- If we delete ns under the object will also delete.
- default
- kube-public [ Related to k8's system objects..!]
- kube-system
kubectl get ns
kubectl get all [ it will display all the Objects in the ns.]
kubectl get pods -n kube-system
kubectl get pods -n kube-public
kubectl get pods -n public
kubectl get all -n kube-system
kubectl create namespaces <NS_Name>
kubectl create ns <NS_Name>
kubectl create namespaces <Flipkartapp_ns>
Kubernetes Objects / Workloads :
- Pod
- Service
POD:
- A pod always runs on a NODE.
- A pod is the smallest building block or basic unit of scheduling in k8's.
- In a k8 cluster, a pod represents a running process.
- Inside a pod, you can have one or more containers.
- Those containers all share Unique Network IP,
- Storage,
- Network & any other specification applied to the pod.
- Each pod has its unique IP Address within the cluster.
How to create Objects/ workloads:
- Interactive way [ Through Commands ]
- Declarative way. [ yml file ]
javawebapp.yml
kind: Pod
metadata:
name:
labels:
<Key>: <Value>
namespaces: <Enter_ns>
spec:
containers:
- name: <Container_Name>
image: < Image_Name>
ports:
- containerport: <Contanerport_number>
NOTE: The Scheduler will try to identify the node wherever we have enough resources.
kubectl get pods
kubectl apply -f <yml_fn>
kubectl apply -f javawebapp.yml
kubectl get events
kubectl describe pod <Pod_name>
kubectl get pods -o wide
Service:
- Service makes pod accessible / discoverable within the network (Cluster) 0r Outside the Network (Internet).
- When we create a Service we will get one Virtual IP address (Cluster IP).
- This IP will be registered in Kubernetes DNS with its name (Service).
- So Other applications can communicate using the Service name.
- Cluster IP Service [One app can communicate other apps within the cluster]
- Node Port Service [ If you want to communicate outside of the application]
- Load Balance Service
kubectl get pods --show-labels
Class:-003
Kubernetes will create PODs, PODs will have one or more containers.
How Containers can communicate one container to another container within the same PODs?
[ Interview Question ]
Can we have two containers within POD with same PortNumber? [ Interview Question ]
- Since they have used the same network.
- Within the pod container port number should not be the same.
POD LifeCycle :-
Types of POD :-
- One-Container-Per-POD
- Multi-Container-POD / SideCar Container
Class:-004
Class:-005
Class:-006
Class:-007
Class:-008
Class:-009
Class:-010
Class:-011
Class:-012
Class:-013
Class:-014
Class:-015
Class:-016
Class:-017
Class:-018
Class:-019
Class:-020
Class:-021
Class:-022
Labels: Mithun Technologies




0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home