Kubernetes step by step Class Notes


1.understand to create pod using YAML file
2.work with describe command

Task:1 
------
step1: create docker file
step2: create docker image
step3: push image into dockerHub
       so my image is available inside dockerHub

Task:2
-------
step1: take the image from the dockerHub
step2: create a pod inside k8s cluster
       by using YAML Script

take the image location along with tag from the dockerHub
go to DockerHub
go to repository
take the image location:kk1567811/vansro:development


what is the use of kind
--------------------------
it tells to Kubernetes ...what type of k8s object we are going to use
kind: Pod   
Pod ---> "P" must be in Capital
metadata:
name: kkpod1
spec:
containers
image
port


apiserver 
------------
we need to specify the version in your yaml script 
which is available inside your cluster
v1 is the stable version for k8s

1.apiVersion: v1
which Version API Server are using inside your k8s cluster
2.kind ---what type of k8s object we are going to use
3.metadata-->it tells about your pod like your pod name

4.spec------>info about your containers
list out all the containers
1.what is your container name ?
2.where is your image ?
3.what is the port number for your container ?
containers:
name:kkcon1
image:image location
port number:80

 
write a YAML script to create pod
-----------------------------------------
step1: nano pod1.yml --> a new file will be opened 
file name: pod1.yml 
apiVersion: v1
kind: Pod
metadata:
  name: kkpod1
  
spec:
  containers:
    - name: kkcon1
      image: kk1567811/vansro:development
      ports:
        - containerPort: 80


how to execute this YAML Script
-------------------------------------
ans: apply command
kubectl apply -f pod1.yml


what is kubectl
------------------
kubectl is a Kubernetes command line tool 
which is used to interact with Kubernetes cluster

kubectl commands
----------------
kubectl get pods
kubectl get nods
kubectl describe
kubectl delete
kubectl run

we are using kubectl commands inside our cluster


git commands
------------
git clone
git push
git add
git log
docker commands
---------------
docker run
docker build
docker push
docker login

bash commands
------------
Linux commands
ls
ls -l
mkdir
groupadd
useradd




1.what is describe
----------------------
describe is a kubectl command
which is used to display the detailed information 
about your pod


2.display the containers info inside your pod
-----------------------------------------------------
ans: describe
kubectl describe pod kkpod1 | grep -A 5 "Containers"
"C" must be in capital

3.display the pod where it running ?
means which node ?
on which node my pod is running ?
-----------------------------------
ans: kubectl describe pod kkpod1 | grep "Node"
"N" must be in capital

4.display my pod status and IP Address?
------------------------------------------------
kubectl describe pod kkpod1 | grep -A 3 "Status"
"S" must be in capital

































      
 

Comments

Popular posts from this blog

Top 10 Git Commands

Kubernetes cluster setup NOTES step by step using minikube

SonarQube Installation & Configuration Step by step