I created an headless service:
apiVersion: v1
kind: Service
metadata:
name: myapp-service-headless
spec:
ports:
- port: 80
selector:
app: myapp
clusterIP: NoneFrom Kubernets dashboard I can see its Internal endpoints:
myapp-service-headless:80 TCP
myapp-service-headless:0 TCPIn this application, I also set internal endpoint to:
http://myapp-service-headlessBut from outside, how can I access its IP to connect API?
For example, my Kubernets' IP is 192.168.99.100, then connect to 192.168.99.100 is okay?
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