Kubernetes Details
- Anand Nerurkar
- Jul 12, 2022
- 2 min read

Commands
To get pods
kubectl get pod
To get deployment
kubectl get deployment
To get service
kubectl get service
To get help
kubectl -h
To create deployment
kubectl create deployment deployment-name --image image url
To get replicaset
kubectl get replicaset
To describe deployment
kubectl describe deployment deployment-name
To descibe pod
kubectl describe pod
To chnage deployment
kubectl edit deployment
To check log for a pod
kubectl logs pod-name
To go inside pod
kubectl exec -it podname --bin/bash
To delete deployment
kubectl delete deployment deployment-name
To deploy application with deployment file
kubectl apply -f deploy.yml
Kubernetes namespaces
K8 provides below namespaces

to create namespace
kubectl create namespace my-namespace
to deploy in a namespace
kubectl apply -f user-service.yml --namespace=my-namespace
to get deployemnt in a namespace
kubectl get deployment -n my-namespace
To get pod in a namespace
kubectl get pod -n my-namespace
We can configure namespace in deployment file under metadata section
metadata:
namespace: my-namespace
Kubernetes Health Check
2 types of health check
Readiness Probe

Liveness Probe: to check if application is live or not, this is constant checking say every 5 min.


Ingress Component
route the traffic base on routing rule within k8 cluster.
There are 2 types services ,external service -ip for external service are exposed to outside world and for internal service is only exposed in the k8 cluster. User connect on external traffic and then access say DB which is on internal service inside k8 cluster. cluster ip denote ip for internal service while node port and load balancer type denote external service.
Ingress component allow external traffic on k8 cluster based on routing mechanism. We normally access application service with dns name and there should be routing mechanism which can route this dns to respective services. This is where ingress service is being used where we configure hostname, port, path & service.

Ingress make use of Ingress Controller to identify traffic and route it accordingly.

Please check below sample ingress where we define host. For this host, it define routing rule such as path, service and port. Based on this rule, ingress call respective backend service and serve the request.

Please note that host name and its ip we need to map in host.properties
Comments