I have deployed my Ni-Fi application using Kubernetes on-prem setup. Now the image which i am using to spin up the docker container is from docker private registry, which i can see when i deployed using Daemon sets service because my requirement is to spin up only one Pod per node and i don't want to replicate my pod if that is killed/terminated. having said that i want to listen this applications on some ports...so my questions are as below 1) How to open multiple ports for the application which are running on multiple nodes on single pod. 2) i have some configuration files which are in a shell script with environment variables defined within..how to inject this script on to my application which is already running.

  • I would suggest you also to adjust a title of your question as right now it suggests issue when using Kubernetes together with some Configuration Management tool (Chef, Puppet, Anisble) whereas it's in fact about general Kubernetes concepts like Services.
    – Nepomucen
    Jun 6, 2019 at 14:40

1 Answer 1


Welcome on StackExchange @Ravikumar

Ad. 1 - How to open multiple ports for the application which are running on multiple nodes on single pod

  1. You need to define what ports are opened in your container inside of Pod spec. e.g:

apiVersion: v1 kind: Pod metadata: labels: app: example-app name: example-app namespace: default spec: containers: name: multi-port image: perl command: - perl - -Mbignum=bpi - -wle - print bpi(2000) ports: - containerPort: 8080 - containerPort: 8081

  1. Expose your workload externally using Service, e.g.

apiVersion: v1 kind: Service metadata: name: my-app-svc spec: selector: app: example-app ports: - name: http protocol: TCP port: 8080 targetPort: 8080 - name: monitoring protocol: TCP port: 8081 targetPort: 8081

From now on you can refer to your app, distributed over different nodes (Pod replicas) using service DNS name + Port: e.g. my-app-svc:8080 or my-app-svc:8081. Keep in mind this is a valid only within cluster, if your want to expose your app outside of Kubernetes cluster, check other option like ServiceType of LoadBalancer or NodePort, as described in official doc here.

Ad. 2 - For defining environment variables for Pod's container check in official doc here.

  • i have tried the following yaml file with DS it generated one pod per node with the image pulled and also listening on the ports which i mentioned inside, however i am unable to see the commands which are mounted as volume is not passed to the images...can someone tell me why? or what this file needs to execute those scripts within the container image Jun 7, 2019 at 11:44
  • It would be really better if you create a new topic on Stack, your problem seems to be not related anyhow to the original question.
    – Nepomucen
    Jun 7, 2019 at 12:53
  • yes it is @ superuser.com/questions/1446034/… Jun 7, 2019 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .