IT

ALL IT Technology Information

DevOps Kubernetes

DevOps  Kubernetes yml file


What is Kubernetes and why it is used?

 Kubernetes helps you to build cloud-native microservices-based apps. It also supports containerization of existing apps, thereby becoming the foundation of application modernization and letting you develop apps faster.


47. Setup Kubernetes Master and Worker Node on AWS-Hindi/Urdu |Lec-47 |Install Kubernetes step by step

 

*******************COMMANDS FOR DEMO*******************

 

 

 

sudo su

 

apt-get update

 

apt-get install apt-transport-https

 

 

 

 

 

apt install docker.io -y

 

docker --version

 

systemctl start docker

 

systemctl enable docker

 

 

 

sudo curl -s https://packages.cloud.google.com/apt... | sudo apt-key add

 

 

 

 

 

nano /etc/apt/sources.list.d/kubernetes.list

 

 

 

deb http://apt.kubernetes.io/ kubernetes-xenial main

 

 

 

 

 

apt-get update

 

 

 

apt-get install -y kubelet kubeadm kubectl kubernetes-cni

 

 

 

 

 

BOOTSTRAPPING THE MASTER NODE (IN MASTER)

 

 

 

kubeadm init

 

 

 

 

 

COPY THE COMMAND TO RUN IN NODES & SAVE IN NOTEPAD

 

 

 

mkdir -p $HOME/.kube

 

cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

 

 

 

 

 

chown $(id -u):$(id -g) $HOME/.kube/config

 

 

 

kubectl apply -f https://raw.githubusercontent.com/cor...

 

 

 

kubectl apply -f https://raw.githubusercontent.com/cor...

 

 

 

CONFIGURE WORKER NODES (IN NODES)

 

 

 

COPY LONG CODE PROVIDED MY MASTER IN NODE NOW LIKE CODE GIVEN BELOW

 

 

 

e.g- kubeadm join 172.31.6.165:6443 --token kl9fhu.co2n90v3rxtqllrs --discovery-token-ca-cert-hash

 

 

sha256:b0f8003d23dbf445e0132a53d7aa1922bdef8d553d9eca06e65c928322b3e7c0

 

 

 

GO TO MASTER AND RUN THIS COMMAND

 

kubectl get nodes

 

 

 

**********************END************************************

 

 

 

======================================================================================================

 

 

 

48. Installation of Minikube and Detailed Lab Part-1-Hindi/Urdu | Lec-48 | Kubernetes complete tutorial

 

 

 

***********Command used in Lecture********************************

 

 

 

sudo su

 

 

 

Now install docker

 

 

 

sudo apt update && apt -y install docker.io

 

 

 

install Kubectl

 

 

 

curl -LO https://storage.googleapis.com/kubern... -s https://storage.googleapis.com/kubern... && chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl

 

 

 

install Minikube

 

 

 

curl -Lo minikube https://storage.googleapis.com/miniku... && chmod +x minikube && sudo mv minikube /usr/local/bin/

 

 

 

 

 

 ***************************************************************************

 

kind: Pod                            

 

apiVersion: v1                   

 

metadata:                         

 

  name: testpod                

 

spec:                                   

 

  containers:                    

 

    - name: c00                   

 

      image: ubuntu            

 

      command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

  restartPolicy: Never         # Defaults to Always

 

 

 

kubectl apply -f pod1.yml

 

 

 

 

 

************************************************************************************************************************************

 

 

 

MULTI CONTAINER POD ENVIRONMENT

 

 

 

kind: Pod

 

apiVersion: v1

 

  name: testpod3

 

spec:

 

  containers:

 

    - name: c00

 

      image: ubuntu

 

      command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

    - name: c01

 

      image: ubuntu

 

      command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

 

 

 

 

*********************************************************************************************************************************

 

POD ENVIRONMENT  VARIABLES

 

 

 

 

 

kind: Pod

 

apiVersion: v1

 

metadata:

 

  name: environments

 

spec:

 

  containers:

 

    - name: c00

 

      image: ubuntu

 

      command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

      env:                        # List of environment variables to be used inside the pod

 

      - name: MYNAME

 

        value: Pradhyuman-ghodela

 

 

 

************************************************************************************************************************************

 

POD WITH PORTS

 

 

 

kind: Pod

 

apiVersion: v1

 

metadata:

 

  name: testpod4

 

spec:

 

  containers:

 

    - name: c00

 

      image: httpd

 

      ports:

 

       - containerPort: 80

 

 

 

********************END*************************************************

 

 

 

 

 

======================================================================================

 

49.  Labels,Selectors,ReplicationController and replicaset in Kubernetes-Hindi/Urdu| Lec-49 | Minikube

 

 

 

*****************YAML Files used in demo************************

 

 

 

EXAMPLE OF LABELS

 

 

 

 

 

kind: Pod

 

apiVersion: v1

 

metadata:

 

  name: delhipod

 

  labels:                                                 

 

    env: development

 

    class: pods

 

spec:

 

    containers:

 

       - name: c00

 

         image: ubuntu

 

         command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

 

 

 

 

 

 

***************************************************************************

 

NODE SELECTOR EXAMPLE

 

 

 

kind: Pod

 

apiVersion: v1

 

metadata:

 

  name: nodelabels

 

  labels:

 

    env: development

 

spec:

 

    containers:

 

       - name: c00

 

         image: ubuntu

 

         command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

    nodeSelector:                                       

 

       hardware: t2-medium

 

*****************************************************************************************************

 

EXAMPLE OF REPLICATION CONTROLLER

 

 

 

kind: ReplicationController             

 

apiVersion: v1

 

metadata:

 

  name: myreplica

 

spec:

 

  replicas: 2          

 

  selector:      

 

    myname: Pradhyuman-ghodela                            

 

  template:              

 

    metadata:

 

      name: testpod6

 

      labels:          

 

        myname: Pradhyuman-ghodela

 

    spec:

 

     containers:

 

       - name: c00

 

         image: ubuntu

 

         command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

 

 

 

 

****************************************************************************************************************

 

EXAMPLE OF REPLICA SET

 

 

 

 

 

kind: ReplicaSet                                  

 

apiVersion: apps/v1                          

 

metadata:

 

  name: myrs

 

spec:

 

  replicas: 2

 

  selector:                

 

    matchExpressions:                             # these must match the labels

 

      - {key: myname, operator: In, values: [Pradhyuman-ghodela, jay , pra]}

 

      - {key: env, operator: NotIn, values: [production]}

 

  template:    

 

    metadata:

 

      name: testpod7

 

      labels:            

 

        myname: Pradhyuman-ghodela

 

    spec:

 

     containers:

 

       - name: c00

 

         image: ubuntu

 

         command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

 

 

**************************************END*****************************

 

 

 

 

 

==================================================================================================

 

 

 

50.Deployment Object in Kubernetes-Hindi  | Lec-50  What is Kubernetes and how it works | Devops

 

 

 

****************************************************************

 

COMMANDS USED IN THIS VIDEO

 

 

 

sudo su

 

 

 

command to install docker is

 

 

 

sudo apt update && apt -y install docker.io

 

 

 

install Kubectl now with the given link

 

 

 

curl -LO https://storage.googleapis.com/kubern... -s https://storage.googleapis.com/kubern... && chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl

 

 

 

install Minikube with the given link

 

 

 

curl -Lo minikube https://storage.googleapis.com/miniku... && chmod +x minikube && sudo mv minikube /usr/local/bin/

 

 

 

apt install conntrack

 

 

 

minikube start --vm-driver=none

 

minikube status

 

kubectl version

 

kubectl get nodes

 

 

 

******************************

 

 

 

kind: Deployment

 

apiVersion: apps/v1

 

metadata:

 

   name: mydeployments

 

spec:

 

   replicas: 2

 

   selector:   

 

    matchLabels:

 

     name: deployment

 

   template:

 

     metadata:

 

       name: testpod

 

       labels:

 

         name: deployment

 

     spec:

 

      containers:

 

        - name: c00

 

          image: ubuntu

 

          command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5; done"]

 

 

 

 

 

*******************************************END********************

 

 

 

========================================================================================================

 

 

 

51.

 

==============================================

 

LEC-51 DEVOPS TECHNICAL GUFTGU NOTES

 

====================

 

 Install Docker

 

$  sudo apt update && apt -y install docker.io

 

 

 

 Install kubectl

 

$  curl -LO https://storage.googleapis.com/kubern... -s https://storage.googleapis.com/kubern... &&   chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl

 

 

 

 Install Minikube

 

$  curl -Lo minikube https://storage.googleapis.com/miniku... && chmod +x minikube && sudo mv minikube /usr/local/bin/

 

 

 

 Start Minikube

 

$  apt install conntrack

 

$  minikube start --vm-driver=none

 

$  minikube status

 

=================================

 

KUBERNETES NETWORKING

 

=================================

 

kind: Pod

 

apiVersion: v1

 

metadata:

 

  name: testpod

 

spec:

 

  containers:

 

    - name: c00

 

      image: ubuntu

 

      command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

    - name: c01

 

      image: httpd

 

      ports:

 

       - containerPort: 80

 

================

 

kind: Deployment

 

apiVersion: apps/v1

 

metadata:

 

   name: mydeployments

 

spec:

 

   replicas: 1

 

   selector:      # tells the controller which pods to watch/belong to

 

    matchLabels:

 

     name: deployment

 

   template:

 

     metadata:

 

       name: testpod1

 

       labels:

 

         name: deployment

 

     spec:

 

      containers:

 

        - name: c00

 

          image: httpd

 

          ports:

 

          - containerPort: 80

 

====================

 

kind: Service                             # Defines to create Service type Object

 

apiVersion: v1

 

metadata:

 

  name: demoservice

 

spec:

 

  ports:

 

    - port: 80                               # Containers port exposed

 

      targetPort: 80                     # Pods port

 

  selector:

 

    name: deployment                    # Apply this service to any pods which has the specific label

 

  type: ClusterIP                       # Specifies the service type i.e ClusterIP or NodePort

 

 

 

$ kubectl get svc

 

 

 

 

 

===========================

 

volume labs

 

===========================

 

 

 

 

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: myvolemptydir

 

spec:

 

  containers:

 

  - name: c1

 

    image: centos

 

    command: ["/bin/bash", "-c", "sleep 15000"]

 

    volumeMounts:                                    # Mount definition inside the container

 

      - name: xchange

 

        mountPath: "/tmp/xchange"        

 

  - name: c2

 

    image: centos

 

    command: ["/bin/bash", "-c", "sleep 10000"]

 

    volumeMounts:

 

      - name: xchange

 

        mountPath: "/tmp/data"

 

  volumes:                                                 

 

  - name: xchange

 

    emptyDir: {}

 

 

 

 

 

========================

 

HOST PATH

 

========================

 

 

 

 

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: myvolhostpath

 

spec:

 

  containers:

 

  - image: centos

 

    name: testc

 

    command: ["/bin/bash", "-c", "sleep 15000"]

 

    volumeMounts:

 

    - mountPath: /tmp/hostpath

 

      name: testvolume

 

  volumes:

 

  - name: testvolume

 

    hostPath:

 

      path: /tmp/data

 

 

 

============================================================================

 

 

 

 

 

LEC-52-Kubernetes complete tutorials.

 

====================

 

 Install Docker

 

$  sudo apt update && apt -y install docker.io

 

 

 

 Install kubectl

 

$  curl -LO https://storage.googleapis.com/kubern... -s https://storage.googleapis.com/kubern... &&   chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl

 

 

 

 Install Minikube

 

$  curl -Lo minikube https://storage.googleapis.com/miniku... && chmod +x minikube && sudo mv minikube /usr/local/bin/

 

 

 

 Start Minikube

 

$  apt install conntrack

 

$  minikube start --vm-driver=none

 

$  minikube status

 

=================================

 

PERSISTENT VOLUME

 

================================

 

apiVersion: v1

 

kind: PersistentVolume

 

metadata:

 

  name: myebsvol

 

spec:

 

  capacity:

 

    storage: 1Gi

 

  accessModes:

 

    - ReadWriteOnce

 

  persistentVolumeReclaimPolicy: Recycle

 

  awsElasticBlockStore:

 

    volumeID:           # YAHAN APNI EBS VOLUME ID DAALO

 

    fsType: ext4

 

============

 

apiVersion: v1

 

kind: PersistentVolumeClaim

 

metadata:

 

  name: myebsvolclaim

 

spec:

 

  accessModes:

 

    - ReadWriteOnce

 

  resources:

 

    requests:

 

      storage: 1Gi

 

==================================================================================================================

 

apiVersion: apps/v1

 

kind: Deployment

 

metadata:

 

  name: pvdeploy

 

spec:

 

  replicas: 1

 

  selector:      # tells the controller which pods to watch/belong to

 

    matchLabels:

 

     app: mypv

 

  template:

 

    metadata:

 

      labels:

 

        app: mypv

 

    spec:

 

      containers:

 

      - name: shell

 

        image: centos

 

        command: ["bin/bash", "-c", "sleep 10000"]

 

        volumeMounts:

 

        - name: mypd

 

          mountPath: "/tmp/persistent"

 

      volumes:

 

        - name: mypd

 

          persistentVolumeClaim:

 

            claimName: myebsvolclaim

 

==========================================================================================================================

 

HEALTHCHECK/LIVENESSPROBE

 

==========================================================================================================================

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  labels:

 

    test: liveness

 

  name: mylivenessprobe

 

spec:

 

  containers:

 

  - name: liveness

 

    image: ubuntu

 

    args:

 

    - /bin/sh

 

    - -c

 

    - touch /tmp/healthy; sleep 1000

 

    livenessProbe:                                        

 

      exec:

 

        command:                                       

 

        - cat              

 

        - /tmp/healthy

 

      initialDelaySeconds: 5        

 

      periodSeconds: 5                                

 

      timeoutSeconds: 30                            

 

----------------------------------------

 

 

 

 

 

===================================================================================================

 

 

 

 

 

LEC 53 NOTES

 

=======================================================

 

 Install Docker

 

$  sudo apt update && apt -y install docker.io

 

 

 

 Install kubectl

 

$  curl -LO https://storage.googleapis.com/kubern... -s https://storage.googleapis.com/kubern... &&   chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl

 

 

 

 Install Minikube

 

$  curl -Lo minikube https://storage.googleapis.com/miniku... && chmod +x minikube && sudo mv minikube /usr/local/bin/

 

 

 

 Start Minikube

 

$  apt install conntrack

 

$  minikube start --vm-driver=none

 

$  minikube status

 

 

 

configmap

 

====================================================================

 

 apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: myvolconfig

 

spec:

 

  containers:

 

  - name: c1

 

    image: centos

 

    command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

    volumeMounts:

 

      - name: testconfigmap

 

        mountPath: "/tmp/config"   # the config files will be mounted as ReadOnly by default here

 

  volumes:

 

  - name: testconfigmap

 

    configMap:

 

       name: mymap   # this should match the config map name created in the first step

 

       items:

 

       - key: sample.conf

 

         path: sample.conf

 

==============================================================================

 

 

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: myenvconfig

 

spec:

 

  containers:

 

  - name: c1

 

    image: centos

 

    command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

    env:

 

    - name: MYENV         # env name in which value of the key is stored

 

      valueFrom:

 

        configMapKeyRef:

 

          name: mymap      # name of the config created

 

          key: sample.conf          

 

=========================================================

 

 apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: myvolsecret

 

spec:

 

  containers:

 

  - name: c1

 

    image: centos

 

    command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

    volumeMounts:

 

      - name: testsecret

 

        mountPath: "/tmp/mysecrets"   # the secret files will be mounted as ReadOnly by default here

 

  volumes:

 

  - name: testsecret

 

    secret:

 

       secretName: mysecret

 

========================================================

 

 

 

 

 

$*^&$#*(&^*(^&*(%&(^&%*(^&)(%&^(*%&^*(#&$%*$^)$^++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

 

 

LEC 54 NOTES TECHNICAL GUFTGU

 

====================

 

 Install Docker

 

$  sudo apt update && apt -y install docker.io

 

 

 

 Install kubectl

 

$  curl -LO https://storage.googleapis.com/kubern... -s https://storage.googleapis.com/kubern... &&   chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl

 

 

 

 Install Minikube

 

$  curl -Lo minikube https://storage.googleapis.com/miniku... && chmod +x minikube && sudo mv minikube /usr/local/bin/

 

 

 

 Start Minikube

 

$  apt install conntrack

 

$  minikube start --vm-driver=none

 

$  minikube status

 

 

 

==============================NAMESPACES===================================

 

apiVersion: v1

 

kind: Namespace

 

metadata:

 

   name: dev

 

   labels:

 

     name: dev

 

 

 

=================================to create a pod=================

 

vi pod.yml

 

 

 

 

 

kind: Pod                            

 

apiVersion: v1                   

 

metadata:                         

 

  name: testpod                

 

spec:                                  

 

  containers:                    

 

    - name: c00                    

 

      image: ubuntu            

 

      command: ["/bin/bash", "-c", "while true; do echo Technical Guftgu; sleep 5 ; done"]

 

  restartPolicy: Never     

 

==============================================================================================

 

 

 

$ kubectl config set-context $(kubectl config current-context) --namespace=dev

 

$ kubectl config view | grep namespace:

 

==============================================================================================

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: resources

 

spec:

 

  containers:

 

  - name: resource

 

    image: centos

 

    command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

    resources:                                        

 

      requests:

 

        memory: "64Mi"

 

        cpu: "100m"

 

      limits:

 

        memory: "128Mi"

 

        cpu: "200m"

 

 

 

============RESOURCEQUOTA========================================

 

 

 

apiVersion: v1

 

kind: ResourceQuota

 

metadata:

 

   name: myquota

 

spec:

 

  hard:

 

    limits.cpu: "400m"

 

    limits.memory: "400Mi"

 

    requests.cpu: "200m"

 

    requests.memory: "200Mi"

 

===========================================================

 

kind: Deployment

 

apiVersion: apps/v1

 

metadata:

 

  name: deployments

 

spec:

 

  replicas: 3

 

  selector:    

 

    matchLabels:

 

     objtype: deployment

 

  template:

 

    metadata:

 

      name: testpod8

 

      labels:

 

        objtype: deployment

 

    spec:

 

     containers:

 

       - name: c00

 

         image: ubuntu

 

         command: ["/bin/bash", "-c", "while true; do echo Pradhyuman-ghodela; sleep 5 ; done"]

 

         resources:

 

            requests:

 

              cpu: "200m"

 

============================================================

 

apiVersion: v1

 

kind: LimitRange

 

metadata:

 

  name: cpu-limit-range

 

spec:

 

  limits:

 

  - default:

 

      cpu: 1

 

    defaultRequest:

 

      cpu: 0.5

 

    type: Container

 

 

 

==============cpu2.yml======================================

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: default-cpu-demo-2

 

spec:

 

  containers:

 

  - name: default-cpu-demo-2-ctr

 

    image: nginx

 

    resources:

 

      limits:

 

        cpu: "1"

 

=================================================================================================

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: default-cpu-demo-3

 

spec:

 

  containers:

 

  - name: default-cpu-demo-3-ctr

 

    image: nginx

 

    resources:

 

      requests:

 

        cpu: "0.75"

 

===============================================

 

 

 

 

 

 

 

+*+*+*+*+*+*+*+*+*+*+*+************************+*++*+**+*+*+*+*+*+*+*+*+*+*+*+*+*++*+*+*+*+*+*+*++*

 

 

 

 

 

LEC 55 NOTES #kubernetes

 

====================

 

 Install Docker

 

$  sudo apt update && apt -y install docker.io

 

 

 

 Install kubectl

 

$  curl -LO https://storage.googleapis.com/kubern... -s https://storage.googleapis.com/kubern... &&   chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl

 

 

 

 Install Minikube

 

$  curl -Lo minikube https://storage.googleapis.com/miniku... && chmod +x minikube && sudo mv minikube /usr/local/bin/

 

 

 

 Start Minikube

 

$  apt install conntrack

 

$  minikube start --vm-driver=none

 

$  minikube status

 

==============cpu2.yml=========================================================================

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: default-cpu-demo-2

 

spec:

 

  containers:

 

  - name: default-cpu-demo-2-ctr

 

    image: nginx

 

    resources:

 

      limits:

 

        cpu: "1"

 

=================================================================================================

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: default-cpu-demo-3

 

spec:

 

  containers:

 

  - name: default-cpu-demo-3-ctr

 

    image: nginx

 

    resources:

 

      requests:

 

        cpu: "0.75"

 

=================================MEMDEFAULT.YML========================================

 

apiVersion: v1

 

kind: LimitRange

 

metadata:

 

  name: mem-min-max-demo-lr

 

spec:

 

  limits:

 

  - max:

 

      memory: 1Gi

 

    min:

 

      memory: 500Mi

 

    type: Container

 

==========

 

apiVersion: v1

 

kind: Pod

 

metadata:

 

  name: constraints-mem-demo

 

spec:

 

  containers:

 

  - name: constraints-mem-demo-ctr

 

    image: nginx

 

    resources:

 

      limits:

 

        memory: "800Mi"

 

      requests:

 

        memory: "600Mi"

 

 

 

 

 

- If request is not specified & limit is given, then request = limit

 

=================

 

$ wget -O metricserver.yml https://github.com/kubernetes-sigs/me...

 

--------------

 

kind: Deployment

 

apiVersion: apps/v1

 

metadata:

 

   name: mydeploy

 

spec:

 

   replicas: 1

 

   selector:

 

    matchLabels:

 

     name: deployment

 

   template:

 

     metadata:

 

       name: testpod8

 

       labels:

 

         name: deployment

 

     spec:

 

      containers:

 

        - name: c00

 

          image: httpd

 

          ports:

 

          - containerPort: 80

 

          resources:

 

            limits:

 

              cpu: 500m

 

            requests:

 

              cpu: 200m

 

---------------------

 

$ kubectl autoscale deployment mydeploy --cpu-percent=20 --min=1 --max=10

 

--------------

 

 

 

 

 

*+*++++*+**+**+**++*+*+*+**+*++*+*+**+*+**++*+*+*+*+**+**+*+*+*+**+*++*+*+***++**

 

 

 

LEC 56 NOTES TECHNICAL GUFTGU

 

====================

 

 Install Docker

 

$  sudo apt update && apt -y install docker.io

 

 

 

 Install kubectl

 

$  curl -LO https://storage.googleapis.com/kubern... -s https://storage.googleapis.com/kubern... &&   chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl

 

 

 

 Install Minikube

 

$  curl -Lo minikube https://storage.googleapis.com/miniku... && chmod +x minikube && sudo mv minikube /usr/local/bin/

 

 

 

 Start Minikube

 

$  apt install conntrack

 

$  minikube start --vm-driver=none

 

$  minikube status

 

===========Job=====================================

 

apiVersion: batch/v1

 

kind: Job

 

metadata:

 

  name: testjob

 

spec:

 

  template:

 

    metadata:

 

      name: testjob

 

    spec:

 

      containers:

 

      - name: counter

 

        image: centos:7

 

        command: ["bin/bash", "-c", "echo Pradhyuman-ghodela; sleep 5"]

 

      restartPolicy: Never

 

--------------

 

apiVersion: batch/v1

 

kind: Job

 

metadata:

 

  name: testjob

 

spec:

 

  parallelism: 5                           # Runs for pods in parallel

 

  activeDeadlineSeconds: 10  # Timesout after 30 sec

 

  template:

 

    metadata:

 

      name: testjob

 

    spec:

 

      containers:

 

      - name: counter

 

        image: centos:7

 

        command: ["bin/bash", "-c", "echo Pradhyuman-ghodela; sleep 20"]

 

      restartPolicy: Never

 

-------------

 

apiVersion: batch/v1beta1

 

kind: CronJob

 

metadata:

 

 name: bhupi

 

spec:

 

 schedule: "* * * * *"

 

 jobTemplate:

 

   spec:

 

     template:

 

       spec:

 

         containers:

 

         - image: ubuntu

 

           name: pra

 

           command: ["/bin/bash", "-c", "echo Pradhyuman-ghodela; sleep 5"]

 

         restartPolicy: Never

 

=================


0 Comments: