DMCA.com Protection Status Trending Topics About Devops: inject config file in pods

Friday, 4 June 2021

inject config file in pods

 apiVersion: v1

kind: Pod

metadata:

  name: nginx

 spec:

      containers:

      - name: nginx

        image: nginx

        env:

         - name: variablefromcm

           valueFrom:

              conFigMapKeyRef:

                      key: variable2

                      name : cm12


kubectl apply -f pod.yml


kubectl exec -it nginx/bin/bash


inside pod

env




how to add multiple varibales :

kubectl explain pod --recursive



vi pod.yml



apiVersion: v1

kind: Pod

metadata:

  name: nginx

 spec:

      containers:

      - name: nginx

        image: nginx

        envFrom:

           valueFrom:

              - conFigMapKeyRef:

                 name:cm12





kubectl apply -f pod.yml








No comments: