Skip to content

Instantly share code, notes, and snippets.

@reyhansofian
Created February 24, 2019 11:04
Show Gist options
  • Save reyhansofian/af1bab9b437dcfb570fa263e101635bb to your computer and use it in GitHub Desktop.
Save reyhansofian/af1bab9b437dcfb570fa263e101635bb to your computer and use it in GitHub Desktop.
Kubernetes manifest using configmap reload container
apiVersion: v1
kind: Service
metadata:
labels:
test-app: test
name: test
namespace: default
spec:
externalTrafficPolicy: Cluster
ports:
- nodePort: 30321
port: 3000
protocol: TCP
targetPort: 3000
selector:
test-app: test
sessionAffinity: None
type: NodePort
status:
loadBalancer: {}
---
apiVersion: extensions/v1
kind: Deployment
metadata:
name: test
spec:
revisionHistoryLimit: 2
strategy:
type: RollingUpdate
replicas: 1
selector:
matchLabels:
test-app: test
template:
metadata:
labels:
test-app: test
spec:
volumes:
- name: config-volume
configMap:
name: test-config
containers:
- name: configmap-reload
image: "jimmidyson/configmap-reload:v0.1"
imagePullPolicy: "IfNotPresent"
args:
- --volume-dir=/etc/config
- --webhook-url=http://localhost:3000/-/reload
volumeMounts:
- name: config-volume
mountPath: /etc/config
readOnly: true
- name: test
image: reyhan/docker-try-config:1.0.3
command: ["npm", "start"]
imagePullPolicy: Never
livenessProbe:
httpGet:
path: /info
port: 3000
initialDelaySeconds: 90
periodSeconds: 5
readinessProbe:
httpGet:
path: /info
port: 3000
initialDelaySeconds: 5
periodSeconds: 5
ports:
- containerPort: 3000
volumeMounts:
- name: config-volume
mountPath: /etc/config
resources:
requests:
memory: "256Mi"
cpu: "64m"
limits:
memory: "512Mi"
cpu: "256m"
env:
- name: ENV_SQL_CLIENT
value: "mysql"
- name: ENV_SQL_HOST
value: "13.67.44.182"
- name: ENV_IS_MAINTENANCE
valueFrom:
configMapKeyRef:
name: test-config
key: ENV_IS_MAINTENANCE
- name: ENV_IS_BLOWN_UP
valueFrom:
configMapKeyRef:
name: test-config
key: ENV_IS_BLOWN_UP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment