Skip to content

Instantly share code, notes, and snippets.

@xcoulon
Created November 19, 2017 15:51
Show Gist options
  • Save xcoulon/112ea435e56bbcc8c7689ada17e7828a to your computer and use it in GitHub Desktop.
Save xcoulon/112ea435e56bbcc8c7689ada17e7828a to your computer and use it in GitHub Desktop.
Managing Pod configuration using ConfigMaps and Secrets in Kubernetes (resource for the story on Medium)
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: webapp
spec:
template:
metadata:
labels:
app: webapp
spec:
volumes:
- name: config-volume
configMap:
name: app-config
containers:
- image: xcoulon/go-url-shortener:0.2.0
name: go-url-shortener
volumeMounts:
- name: config-volume
mountPath: /etc/config
ports:
- containerPort: 8080
env:
- name: POSTGRES_HOST
value: postgres
- name: POSTGRES_PORT
value: "5432"
- name: CONFIG_FILE
value: /etc/config/config.yaml
- name: POSTGRES_DATABASE
valueFrom:
secretKeyRef:
name: database-secret-config
key: dbname
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: database-secret-config
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: database-secret-config
key: password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment