2
votes

I’d like to use Kubernetes, as I’m reading everywhere : “Kubernetes is, without a doubt, the leading container orchestrator available today.“

My issue here is with the networking. I need to expose external IP to each of the pods. I need that my pods are seen as if they were traditional VM or HW servers. Meaning that I need all the ports to be exposed.

What I see so far, is I can expose only a limited list of ports.

Am I correct ? Or do I miss something ?

Cheers, Raoul

2
If VMs or bare-metal servers are a better match for your application, by all means, use them. (There are some docker questions that want to listen to thousands of TCP ports, and the usual answer is to disable Docker's networking layer; that's even harder in Kubernetes.)David Maze
Well, I need the containers feature of instant deleta and instant spawn. I'm not looking at absoulty use Kubernetes, I'm just looking for the good orchestration tool to span and delete remote containers. I've heard about K8s, so my question was more, It is a good tool for me or what other containers provisioning tool do you recommend?Raoul Debaze
@RaoulDebaze Could you shed some light on why it is needed to have all ports exposed? Does your application expect incoming traffic on random ports?PjoterS
No not random ports effectively. But at least a range of 100 continuous port. I was more thinking on how can I use K8S and make my application feel the most possible as if it were on normal serversRaoul Debaze

2 Answers

1
votes

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: v1
kind: Service
metadata:
  name: my-service
spec:
  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

0
votes

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.