Skip to content

Instantly share code, notes, and snippets.

@spattanaik75
Created September 27, 2023 11:33
Show Gist options
  • Save spattanaik75/27187f02a0811aa19ab7ea1e14a3e694 to your computer and use it in GitHub Desktop.
Save spattanaik75/27187f02a0811aa19ab7ea1e14a3e694 to your computer and use it in GitHub Desktop.
How to use volumemounts with configmaps
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: app
name: app
namespace: portals
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: app
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: app
spec:
containers:
- env:
- name: JAVA_OPTS
value: "-Dspring.config.location=/app/resources"
envFrom:
- configMapRef:
name: oauth-config
optional: false
- configMapRef:
name: app-config
optional: false
- secretRef:
name: mongodb-secret
optional: false
- secretRef:
name: mysql-secret
optional: false
- secretRef:
name: app-secret
optional: false
image: something:1.0.0
##### FOR DEBUGGING PURPOSES
# command: [ "/bin/bash", "-c", "--" ]
# args: [ "while true; do sleep 30; done;" ]
imagePullPolicy: Always
name: app
resources: {}
securityContext:
allowPrivilegeEscalation: false
capabilities: {}
privileged: false
readOnlyRootFilesystem: false
runAsNonRoot: false
stdin: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
tty: true
volumeMounts:
- mountPath: /opt/app-root/config
name: app
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 256
items:
- key: application.properties
path: application.properties
name: app-config
optional: false
name: app
---
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
namespace: portals
data:
application.properties: |-
# active-profile=default
logging.level.web=TRACE
logging.level.org.springframework.web.server=TRACE
logging.level.org.apache.coyote.http11.Http11InputBuffer=DEBUG
logging.level.org.springframework.web.cors=TRACE
logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG.
logging.level.org.apache.tomcat.util.http.Rfc6265CookieProcessor=DEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment