Kubernetes add conf parameters end of line to the conf file

Viewed 26

I have a Kubernetes deployment and I want to insert some conf parameters end of file while creating the pod. How can I do that ? It shouldn't restart the pod.

1 Answers

You can either use the command directive to override the entrypoint of the container, or mount in the conf as a configmap, then edit that.

Here's an example of overriding the entrypoint -- more reading available here

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp-deployment
  labels:
    app: myapp
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: myapp:latest
        command: ['/bin/bash -c "echo newvkey=newval >/etc/myconf.conf && ./entrypoint.sh"']
        ports:
        - containerPort: 80
Related