Skip to content

Instantly share code, notes, and snippets.

@Gutek
Created March 9, 2018 09:47
Show Gist options
  • Save Gutek/e9133cb41a41c7897c23428c3f947125 to your computer and use it in GitHub Desktop.
Save Gutek/e9133cb41a41c7897c23428c3f947125 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: Namespace
metadata:
name: samples
---
apiVersion: v1
kind: ConfigMap
metadata:
name: sample-api-cm
namespace: samples
data:
SAMPLE__ENV1: val1
SAMPLE__ENV2: val2
SECTION__ONE: k8s
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: sample-api-dep
namespace: samples
labels:
app: sample-api-app
spec:
replicas: 3
selector:
matchLabels:
app: sample-api-app
# wait 3 seconds before starting new instance/replica
minReadySeconds: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 30%
maxUnavailable: 30%
template:
metadata:
annotations:
kubernetes.io/change-cause: "First Deployment"
labels:
app: sample-api-app
spec:
containers:
- name: sample-api-container
image: gIMAGES
imagePullPolicy: Always
ports:
- containerPort: 80
# works
env:
- name: SAMPLE__ENV1
valueFrom:
configMapKeyRef:
name: sample-api-cm
key: SAMPLE__ENV1
- name: SAMPLE__ENV2
valueFrom:
configMapKeyRef:
name: sample-api-cm
key: SAMPLE__ENV2
# does not. comment out above etc
envFrom:
- configMapRef:
name: sample-api-cm
@y3ti
Copy link

y3ti commented Mar 9, 2018

Here is a fix:

         envFrom:
         - configMapRef:
-          name: sample-api-cm
+            name: sample-api-cm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment