I have one own nginx configuration /home/ubuntu/workspace/web.conf
generated by script. I prefer to have it under /etc/nginx/conf.d
besides default.conf
Below is the nginx.yaml
apiVersion: v1 kind: Pod metadata: name: nginx spec: volumes: - name: webconf hostPath: path: /home/ubuntu/workspace/web.conf containers: - image: nginx name: nginx ports: - containerPort: 18001 protocol: TCP volumeMounts: - mountPath: /etc/nginx/conf.d/web.conf name: web
While it is mapped as folder only
$ kubectl create -f nginx.yaml pod "nginx" created $ kubectl exec -it nginx -- bash root@nginx:/app# ls -al /etc/nginx/conf.d/ total 12 drwxr-xr-x 1 root root 4096 Aug 3 12:27 . drwxr-xr-x 1 root root 4096 Aug 3 11:46 .. -rw-r--r-- 2 root root 1093 Jul 11 13:06 default.conf drwxr-xr-x 2 root root 0 Aug 3 11:46 web.conf
It works for docker container -v hostfile:containerfile
.
How can I do this in kubernetes ?
BTW: I use minikube 0.21.0
on Ubuntu 16.04 LTS
with kvm