Kubernetes pod

 Static pods

In pod yaml file in /etc/kubernetes/manifests folder

Pod will create automatically depending on the file.

If file deleted, pod also got delete


1. Search "kubelet" in system: find / -name kubelet

2. Go to the path find config.yaml file

3. In the file find "staticPodPath"


check #docker ps

check #kubectl get pods --all-namespaces

(check pod name contains node)

Create pod by run #kubectl run --restart=Never --image=busybox static-busybox --dry-run -o yaml --command -- sleep 1000 > /etc/kubernetes/manifests/static-busybox.yaml

Create pod by run #kubectl run --generator=run-pod/v1 nginx-pod --image=nginx:alpine

Create service by run #kubectl expose pod redis --port=6379 --name redis-service

Create deployment by run #kubectl create deployment webapp --image=kodekloud/webapp-color

#kubectl scale deployment/webapp --replicas=3

Search pod by label #kubectl get all --selector env=prod,bu=finance,tier=frontend

Use case: create master host





Pod

#kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/application/nginx-app.yaml


Create #kubectl create -f <yaml file>

Check #kubectl get pods

Check #kubectl get pods -o wide

Check #kubectl describe pod <pod name>


Multi container Pod 

Example yaml file

apiVersion: v1

kind: Pod

metadata:

  name: webapp

  labels: 

    name: webapp

spec:

  containers:

  - name: webapp

    image: webapp

  - name: log-agent

    image: log-agent


Pod Initcontainer

Example yaml file


apiVersion: v1

kind: Pod

metadata:

  name: myapp-pod

  labels:

    app: myapp

spec:

  containers:

  - name: myapp-container

    image: busybox:1.28

    command: ['sh', '-c', 'echo The app is running! && sleep 3600']

  initContainers:

  - name: init-myservice

    image: busybox

    command: ['sh', '-c', 'git clone <some-repository-that-will-be-used-by-application> ; done;']


Comments

Popular posts from this blog

Nginx Proxy & Load Balance & LNMP

Snort+barnyard2+Snorby CentOS 6.5_64 Installation

ORACLE Error