Thursday, 4 March 2021

Kubernetes - Getting started with - Introduction, Pods

Kubernetes Building Blocks


How communication happens within Kubernetes






Running a Pod (2 ways)
1) kubectl run command
2) kubectl create/apply command with a yaml file

The kubectl get command can be used to pods information and many other kubernetes objects
For ex : kubectl get pod lists all pods
             kubectl get all  lists all resources

Expose a Pod port

By default pods and container are only accessible within kubernetes cluster
To use expose container port externally we can use kubectl port-forward

Ex : kubectl port-forward [name of the pod ] 8080:80  where 8080 is external port and 80 is internal port

Delete Pod

Running Pod will cause deployment to be created
To delete pod use kubectl delete pod or find a deployment and run kubectl delete deployment
kubectl delete  pod [name of pod] will cause pod to be recreated
kubectl delete deployment [name of the deployment] -: delete deployment that manages the pod

To delete a pod which is created using yaml file then we can use below mentioned command
kubectl delete -f file.pod.yml



Sample yaml file for pod creation (Ex : nginx)


kubectl create -f file.pod.yml  will results in error if pod already exists

So alternative way to create or apply changes to a pod is to use kubectl apply -f file.pod.yml

Use --save-config when you want to use kubectl apply in the feature (it saves current properties in resource's annotations)

kubectl apply -f file.pod.yml  --save-config





Pod Health
Kubernetes relies on Probes to determine the health of the pod container

A probe is a diagnostic performed periodically by kubelet on a container




Readiness Probe ; when should a container start receiving traffic?
Liveliness Probe : when should a container restart ?

Reference : Mr.Dan Wahlin  course

Kubernetes - Getting started with - ReplicaSet ,Deployments

ReplicaSet : It is a declarative way to manage the pods.

Deployment : it is a declarative way to manage the pods using ReplicaSet.






How Does Spring Boot Work?






Spring MVC Integration with SpringBoot(Internal mechanism steps-)







Useful Links related to Spring

Spring Web Application Design

Spring Performance


Enable Config Server (Centralized configuration)