How to define options for docker run inside a k8s yaml specification

546 views
Skip to first unread message

shashank....@gmail.com

unread,
Sep 29, 2017, 9:05:43 PM9/29/17
to Kubernetes user discussion and Q&A
Hi,

I have a docker container that I run with following options:
docker run -d --net=host --add-host=moby:127.0.0.1 --shm-size=1G \
-v /Users/spedamallu/Files/Learning/alluxio/alluxio-1.5.0-hadoop-2.8/integration/docker/underStorage:/underStorage \
-e ALLUXIO_MASTER_HOSTNAME=127.0.0.1 \
-e ALLUXIO_WORKER_MEMORY_SIZE=1GB \
-e ALLUXIO_UNDERFS_ADDRESS=/underStorage \
symphony-docker-local.jfrog.io/logsaas/alluxio-local worker

I'm trying to deploy this image via a k8s pod. I know I can set environment variables and resource limits from the specification, but how do I set / give options for container run command? I'm specifically looking on how to set "--net=host --add-host=moby:127.0.0.1" parameters. Here's how I have the configuration for this container in k8s yaml I have so far:

- name: alluxio-worker
image: symphony-docker-local.jfrog.io/logsaas/alluxio-worker:latest
command: ["--net", "host", "--add-host", "moby:127.0.0.1"]
imagePullPolicy: IfNotPresent
ports:
env:
- name: ALLUXIO_MASTER_HOSTNAME
value: "127.0.0.1"
- name: ALLUXIO_WORKER_MEMORY_SIZE
value: "3GB"
- name: ALLUXIO_UNDERFS_ADDRESS
value: "/"
resources:
limits:
cpu: "100m"
memory: "3Gi"
volumeMounts:

Any help is much appreciated!

Thanks in advance,
Shashank

Tim Hockin

unread,
Sep 29, 2017, 11:22:38 PM9/29/17
to Kubernetes user discussion and Q&A
Please look at the API docs for host network.  We don't really have an analog of add-host yet.

--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-users+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

shashank....@gmail.com

unread,
Oct 2, 2017, 1:14:13 PM10/2/17
to Kubernetes user discussion and Q&A
Could you please elaborate. Do not understand what you mean by "look at api docs for host network." According to docker documentation --add-host option is adding a custom host-to-ip mapping. How can I achieve the same using host network api. And I'm running this on Amazon EC2.

Thanks,
Shashank
> To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
>
> To post to this group, send email to kubernet...@googlegroups.com.

Tim Hockin

unread,
Oct 2, 2017, 1:50:44 PM10/2/17
to Kubernetes user discussion and Q&A
You have to look at the kubernetes docs for the kubernetes API.
Kubernetes is not docker.

https://kubernetes.io/docs/api-reference/v1.7/#pod-v1-core

Search for `hostNetwork`.

Tim
Reply all
Reply to author
Forward
0 new messages