Reputation: 5507
I created an headless service:
apiVersion: v1
kind: Service
metadata:
name: myapp-service-headless
spec:
ports:
- port: 80
selector:
app: myapp
clusterIP: None
From Kubernetes dashboard I can see its Internal endpoints
:
myapp-service-headless:80 TCP
myapp-service-headless:0 TCP
In this application, I also set internal endpoint to:
http://myapp-service-headless
But from outside, how can I access its IP to connect API?
For example, my Kubernetes' IP is 192.168.99.100
, then connect to 192.168.99.100
is okay?
Upvotes: 6
Views: 10448
Reputation: 19099
There is two option to expose the service outside, you can use the ingress controller to connect to the server.
The simple method is change your service type to NodePort, then you should be able access server using NodeIP and service external port number.
here is the more info.
https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
Upvotes: 6