Kubernet Learning- Sujit

– What is POD – in 10 lines with 1 YAML example

  1. A Kubernetes pod is a collection of one or more Linux containers, and is the smallest unit of a Kubernetes application.
  2. pod can be composed of multiple, tightly coupled containers or just a single container.
  3. Within the kubernets system, containers in the same pod will share the same compute resources.
  4. Kubernetes does not run containers directly, instead running pods to ensure that each container within them shares the same resources and local network.
  5. Pods also contain shared networking and storage resources for their containers.
  6. A Pod is meant to run a single instance of your application on your cluster
  7. To create pod from yaml file we can use command kubectl create -f pod.yaml
  8. To inspect a Pod running on your cluster we can use command kubectl get pod
  9. To describe pod we can use kubectl describe pods sujit
  10. To edit pod we can use command kubectl edit pods sujit

apiVersion: v1
kind: Pod
metadata:
name: sujit
labels:
app: helloworld

spec:
containers:

-name: devopsschool1

image: scmgalaxy/nginx-devopsschoolv1

ports:

-name: nginx-port
containerPort: 80


– What is ReplicationController – in 4 lines with 1 YAML example

1.A ReplicationController ensures that a specified number of pod replicas are running at any one time

2.A ReplicationController makes sure that a pod is always up and available.

3. It is responsible for managing the pod lifecycle.

4. It is used in time when one wants to make sure that the specified number of pod or at least one pod is running.

5.It has the capability to bring up or down the specified no of pod.

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

  1. Replica Set ensures how many replica of pod should be running and helps with load-balancing in case of an increase in resource usage.
  2. It can be considered as a replacement of replication controller.
  3. A ReplicaSet is a process that runs multiple instances of a Pod
  4. Its purpose is to maintain the specified number of Pod instances running in a cluster at any given time to prevent users from losing access to their application when a Pod fails or is inaccessible.  
  5. ReplicaSet helps bring up a new instance of a Pod when the existing one fails.

apiVersion: v1
kind: ReplicaSet
metadata:
name: my-replicaset
spec:
replicas: 2
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
– name: my-container
image: nginx


– What is Deployment – in 10 lines with 1 YAML example

  1. A deployment allows us to describe an application’s life cycle, such as which images to use for the app, the number of pods there should be, and the way in which they should be updated. 

2. The Kubernetes deployment object lets us:

  • Deploy a replica set or pod
  • Update pods and replica sets
  • Rollback to previous deployment versions
  • Scale a deployment
  • Pause or continue a deployment.

3. Kubernetes Deployment is the process of providing declarative updates to Pods and Replica sets.

4.It allows users to declare the desired state in the yaml file, and the controller will change the current state to the declared state.

5. Deployments represent a set of multiple, identical Pods with no unique identities.

6.A Deployment runs multiple replicas of your application and automatically replaces any instances that fail or become unresponsive

7. Deployments help ensure that one or more instances of your application are available to serve user requests.

8. Deployments are managed by the Kubernetes Deployment controller.

9. To create deployment we can use comand kubectl create deployment my-dep –image=scmgalaxy/nginx-devopsschoolv1 -n=sujit

10.To get deployment we can use kubectl get deploy -n=sujit

11. To edit deployment kubectl edit deploy my-dep -n=sujit

12. To delete deployment kubectl delete pod my-dep-747b4ffb56-2ftv5 my-dep-747b4ffb56-8nvwk my-dep-747b4ffb56-bgnhk my-dep-747b4ffb56-hxsqd my-dep-747b4ffb56-lqqm8 my-dep-747b4ffb56-ppkhg my-dep-747b4ffb56-rt977 -n=sujit

apiVersion: 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

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x