How to create a ClusterIP Service?

8/9/2019

I followed this guide to create a Windows Server container on Azure Kubernetes Service and this guide to secure it with an ingress-controller. I was successful and the web frontend of the container can now be reached via https through the ingress-controller. However, it can also be reached via the external IP adress of the service itself, which is not secure.

Now I already read something about a ClusterIP which, if I understand it correctly, is a type of service that has no external IP adress, but I wasn't able to find specific documentation on how to create one. Also I noticed that my service already has the type load-balancer. Can one service have multiple types or do I have to create an additional service?

-- TigersEye120
azure-kubernetes

1 Answer

8/9/2019

You can have only one service type if you want to expose your application to the internet you can use the service type Load Balancer.

Service ClusterIp will not expose the application to the internet.

apiVersion: v1
kind: Service
metadata:
  name: my-service
  labels:
    run: my-service
spec:
  ports:
  - port: 80
    protocol: TCP
  selector:
    run: my-service

Example if service having clusterIP. If you have not mentation any type in service it will create the default service as ClusterIp assign default IP to the pod.

-- Harsh Manvar
Source: StackOverflow