Search code examples
azurekubernetesazure-container-service

Configuring HTTPS for an internal IP on Azure Kubernetes


I have deployed a Kubernetes cluster to a custom virtual network on Azure using acs-engine. There is an ASP.NET Core 2.0 Kestrel app running on the agent VMs and the app is accessed over VPN through a Service of the Azure internal load balancer type. Now I would like to enable HTTPS on the service. I have already obtained a domain name and a certificate but have no idea how to proceed. Apparently configuring Kestrel to use HTTPS and copying the certificate to each container is not the way to go.

I have checked out tutorials such as ingress on k8s using acs and configure Nginx Ingress Controller for TLS termination on k8s on Azure but both of them end up exposing a public external IP and I want to keep the IP internal and not accessible from the internet. Is this possible? Can it be done without ingresses and their controllers?


Solution

  • While for some reason I still can't access the app through the ingress I was able to create an internal ingress service with the IP I want with the following configuration:

    apiVersion: v1
    kind: Service
    metadata:
      annotations:
          service.beta.kubernetes.io/azure-load-balancer-internal: "true"
      name: nginx-ingress-svc
    spec:
      type: LoadBalancer
      ports:
      - port: 443
        targetPort: 443
      loadBalancerIP: 130.10.1.9
      selector:
        k8s-app: nginx-ingress-controller