Kubernetes, expose all ports Kubernetes, expose all ports kubernetes kubernetes

Kubernetes, expose all ports


In Kubernetes, you will need service to communicate with pods. To expose the pods outside the Kubernetes cluster, you can use k8s service of NodePort type.

apiVersion: v1kind: Servicemetadata:  name: my-servicespec:  selector:    app: MyApp  type: NodePort  ports:    -       port: 8080      nodePort: 30000      name: my-port-8080    -      port: 8081      nodePort: 30001      name: my-port-8081    -      port: 8082      nodePort: 30002      name: my-port-8081

Then you will be able to reach your pods at, https://<node-ip>:nodePort.For in-cluster communication, you can use service's dns: <service-name>.<namespace>.svc:PORT

Update:

Take a look at this guide: Using a Service to Expose Your App


You are correct.
Pods are not "real" servers, their are rather application-instances with open ports.

Because of the docker- and kubernetes-network-implementation it's not possible to build what you want.

I don't know your use-case, but maybe you are not looking for kubernetes.