Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass docker run flags via kubernetes pod

Tags:

Hi I am running kubernetes cluster where I run mailhog container.

But I need to run it with own docker run parameter. If I would run it in docker directly. I would use command:

docker run  mailhog/mailhog -auth-file=./auth.file 

But I need to run it via Kubernetes pod. My pod looks like:

   apiVersion: extensions/v1beta1     kind: Deployment     metadata:       name: mailhog     spec:       replicas: 1       revisionHistoryLimit: 1       strategy:           type: RollingUpdate       template:         metadata:           labels:             app: mailhog         spec:           containers:           - name: mailhog             image: us.gcr.io/com/mailhog:1.0.0             ports:             - containerPort: 8025 

How to achieve to run Docker container with parameter -auth-file=./auth.file via kubernetes. Thanks.

I tried adding under containers

        command: ["-auth-file", "/data/mailhog/auth.file"] 

but then I get

 Failed to start container with docker id 7565654 with error: Error response from daemon: Container command '-auth-file' not found or does not exist. 
like image 679
dina Avatar asked May 21 '17 14:05

dina


1 Answers

thanks to @lang2

here is my deployment.yaml:

apiVersion: extensions/v1beta1 kind: Deployment metadata:   name: mailhog spec:   replicas: 1   revisionHistoryLimit: 1   strategy:       type: RollingUpdate   template:     metadata:       labels:         app: mailhog     spec:       volumes:       - name: secrets-volume         secret:             secretName: mailhog-login       containers:       - name: mailhog         image: us.gcr.io/com/mailhog:1.0.0         resources:           limits:             cpu: 70m             memory: 30Mi           requests:             cpu: 50m             memory: 20Mi         volumeMounts:         - name: secrets-volume           mountPath: /data/mailhog           readOnly: true         ports:         - containerPort: 8025         - containerPort: 1025         args:           - "-auth-file=/data/mailhog/auth.file" 
like image 84
dina Avatar answered Oct 17 '22 07:10

dina