Vijay Kubernetes Learnings
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
- What is POD – in 10 lines with 1 YAML example
Ans: Pod is a group of one or moreĀ Containers, A atom inside the container which manages the IP & Port configurations.
below are the list of commands for Pod
kubectl get pods
kubectl create -f pod1.yaml -n=vijay
kubectl apply -f pod1.yaml -n=vijay
kubectl get pods -n=vijay
kubectl get pods -n=vijay-o wide –show-labels
kubectl delete -f pod1.yaml -n=vijay
apiVersion: v1
kind: Pod
metadata:
name: vijay
labels:
app: helloworld
spec:
containers:
- name: vjcontainer
image: scmgalaxy/nginx-vjcontainer
ports:
- name: nginx-port
containerPort: 80
- What is ReplicationController – in 4 lines with 1 YAML example
Ans: A ReplicationController ensures that a specified number of pod replicas are running at any one time. Replication contains multiple POD.
below are list of commands for ReplicationController
kubectl create -f rc.yaml -n=vijay
kubectl get rc -n=vijay
kubectl apply -f rc.yaml -n=vijay
kubectl delete rc replicationcontroller-example -n=vijay
apiVersion: v1
kind: ReplicationController
metadata:
name: replicationcontroller-example
spec:
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: scmgalaxy/nginx-devopsschoolv1
- What is ReplicaSets – in 4 lines with 1 YAML example
Ans: A ReplicaSet’s purpose is to maintain a stable set of replica Pods running at any given time.
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: replicaset-example
labels:
app: guestbook
tier: frontend
spec:
# modify replicas according to your case
replicas: 3
selector:
matchLabels:
tier: frontend
template:
metadata:
labels:
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
- What is Deployment – in 10 lines with 1 YAML example
Ans: A Deployment provides declarative updates for Pods and ReplicaSets.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80