0

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 .

Dave M
  • 4,514
  • 22
  • 31
  • 30
  • 1
    We are not here to do your job for you. – Michael Hampton Jul 26 '21 at 08:54
  • 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 – anupjohari9211 Jul 26 '21 at 10:39

1 Answers1

1

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.

Srividya
  • 260
  • 1
  • 8