daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #How k8 configures application
  3.  
  4. #Create config map
  5. kubectl create configmap my-map –from-literal=school=LinuxAcademy
  6.  
  7. #Check status of config map
  8. kubectl get configmaps
  9.  
  10. #Detailed description of config map
  11. kubectl describe configmaps my-map
  12.  
  13. #Generate yaml code for config map
  14. kubectl get configmap my-map -o yaml
  15.  
  16. echo “apiVersion: v1
  17. kind: Pod
  18. metadata:
  19.   name: config-test-pod
  20.   namespace: default
  21. spec:
  22.   containers:
  23.   - name: test-container
  24.     image: busybox
  25.     command: [ "/bin/sh", "-c", "env" ]
  26.     env:
  27.       - name: WHAT_SCHOOL
  28.         valueFrom:
  29.           configMapKeyRef:
  30.             name: my-map
  31.             key: school
  32.   restartPolicy: Never” >> pod-config.yaml
  33.  
  34. #Create pod from yaml file
  35. kubectl create -f pod-config.yaml
  36.  
  37. #Check status of pods
  38. kubectl get pods
  39.  
  40. #Display logs for config test pod
  41. kubectl logs config-test-pod
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top