Created
July 13, 2018 07:12
-
-
Save joshy91/492c7e6f959ac6a305fa3d007418bb84 to your computer and use it in GitHub Desktop.
Create configmap yaml to create env variables for pod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Create configmap yaml to create env variables for pod | |
echo “apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: school-config | |
namespace: default | |
data: | |
STUDENT_NAME: “Joshua Davidson” | |
SCHOOL: “Linux Academy” | |
KUBERNETES: “is awesome”” >> school-configMap.yaml | |
kubectl create -f school-configMap.yaml | |
kubectl get configmaps | |
kubectl describe configmap school-config | |
echo “apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: school-config-test-pod | |
spec: | |
containers: | |
- name: test-container | |
image: k8s.gcr.io/busybox | |
command: [ "/bin/sh", "-c", "env" ] | |
envFrom: | |
- configMapRef: | |
name: school-config | |
restartPolicy: Never” >> school-config-pod.yaml | |
kubectl create -f school-config-pod.yaml | |
kubectl describe pod school-config-test-pod | |
sleep 5 | |
kubectl logs school-config-test-pod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment