Score:0

How to deploy docker container and do port mapping/forward using kubernetes YAML manifest

cn flag

Please help me to convert the below docker Command to Kubernetes YAML file along with port mapping/forwarding to the docker container

 # docker run -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 14268:14268 jaegertracing/all-in-one:latest

I tried the configuration below:

enter image description here

But not getting any result.

I need experts here to tell me if the above deployment file is incorrect and if yes what could be the possible changes I can do here to get the results. I have tried several other combination's and I'm not getting any results.

Note: container gets deployed but the port mapping/forwarding is not working. That is where I'm stuck and seeking help .

Michael Hampton avatar
cz flag
We are not here to do your job for you.
anupjohari9211 avatar
cn flag
Hi Michael Hampton, Please note that i dont have any intention to waste r time here and im not even asking you to do my job. I might have posted the Question incorrectly, so i apologize for the same. I searched a lot for the solution and didnt find one. So im taking help on the Forum to find an answer. Plz help me if you can
Score:1
cn flag

If we specify a NodePort service, Kubernetes will allocate a port on every node. The chosen NodePort will be visible in the service spec after creation. Alternatively, one can specify a particular port to be used as NodePort in the spec while creating the service. If a specific NodePort is not specified, a port from a range configured on the Kubernetes cluster (default: 30000-32767) will be picked at random.

In Kubernetes you can define your ports using # port label. This label comes under port configuration in your deployment. According to the configurations you can simply define any number of ports you wish. Following example shows how to define two ports.

apiVersion: v1 
kind: Service
 Metadata:
      name: my-service 
Spec:
  selector: 
     app: MyApp 
  Ports:
    - name: http
      protocol: TCP
      port: 80 
      targetPort: 9376 
    - name: https
      protocol: TCP
      port: 443 
      targetPort: 9377

To do a port forward to local host run the following command.

 kubectl port-forward <pod-name> <locahost-port>:<pod-port>

For more information refer to the links for Docker container port forwarding and node ports.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.