Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #How k8 configures application
- #Create config map
- kubectl create configmap my-map –from-literal=school=LinuxAcademy
- #Check status of config map
- kubectl get configmaps
- #Detailed description of config map
- kubectl describe configmaps my-map
- #Generate yaml code for config map
- kubectl get configmap my-map -o yaml
- echo “apiVersion: v1
- kind: Pod
- metadata:
- name: config-test-pod
- namespace: default
- spec:
- containers:
- - name: test-container
- image: busybox
- command: [ "/bin/sh", "-c", "env" ]
- env:
- - name: WHAT_SCHOOL
- valueFrom:
- configMapKeyRef:
- name: my-map
- key: school
- restartPolicy: Never” >> pod-config.yaml
- #Create pod from yaml file
- kubectl create -f pod-config.yaml
- #Check status of pods
- kubectl get pods
- #Display logs for config test pod
- kubectl logs config-test-pod
Add Comment
Please, Sign In to add comment