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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With