<p>As an experiment I'm trying to run a docker container on Azure using the Azure Container Service and Kubernetes as the orchestrator. I'm running the official nginx image. Here are the steps I am taking:</p>

<p><code>
az group create --name test-group --location westus
az acs create --orchestrator-type=kubernetes --resource-group=test-group --name=k8s-cluster --generate-ssh-keys
</code></p>

<p>I created Kubernetes deployment and service files from a docker compose file using Kompose.</p>

<p><strong>deployment file</strong>
<code>
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    kompose.service.type: LoadBalancer
  creationTimestamp: null
  labels:
    io.kompose.service: test
  name: test
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        io.kompose.service: test
    spec:
      containers:
      - image: nginx:latest
        name: test
        ports:
        - containerPort: 80
        resources: {}
      restartPolicy: Always
status: {}
</code></p>

<p><strong>service file</strong>
<code>
apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.service.type: LoadBalancer
  creationTimestamp: null
  labels:
    io.kompose.service: test
  name: test
spec:
  ports:
  - name: "80"
    port: 80
    targetPort: 80
  selector:
    io.kompose.service: test
  type: LoadBalancer
status:
  loadBalancer: {}
</code></p>

<p>I can then start everything up:</p>

<p><code>
kubectl create -f test-service.yaml,test-deployment.yaml
</code></p>

<p>Once an IP has been exposed I assign a dns prefix to it so I can access my running container like so: <em>http</em>://nginx-test.westus.cloudapp.azure.com/.</p>

<p><strong>My question is, how can I access the service using https? At http<em>s</em>://nginx-test.westus.cloudapp.azure.com/</strong></p>

<p>I don't think I'm supposed to configure nginx for https, since the certificate is not mine. I've tried changing the load balancer to send 443 traffic to port 80, but I receive a timeout error.</p>

<p>I tried mapping port 443 to port 80 in my Kubernetes service config.</p>

<p><code>
ports:
- name: "443"
  port: 443
  targetPort: 80
</code></p>

<p>But that results in:</p>

<p><code>
SSL peer was not expecting a handshake message it received. Error code: SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT
</code></p>

<p>How can I view my running container at <a href="https://nginx-test.westus.cloudapp.azure.com/" rel="nofollow noreferrer">https://nginx-test.westus.cloudapp.azure.com/</a>?</p>

<p>If I understand it correctly, I think you are looking for <code>Nginx Ingress controller</code>.<br>
If we need TLS termination on Kubernetes, we can use ingress controller, on Azure we can use <code>Nginx Ingress controller</code>.<br>
To archive this, we can follow those steps:<br>
1 Deploy the Nginx Ingress controller<br>
2 Create TLS certificates<br>
3 Deploy test http service<br>
4 configure TLS termination<br>
More information about configure Nginx Ingress Controller for TLS termination on Kubernetes on Azure, please refer to this <a href="https://blogs.technet.microsoft.com/livedevopsinjapan/2017/02/28/configure-nginx-ingress-controller-for-tls-termination-on-kubernetes-on-azure-2/" rel="nofollow noreferrer">blog</a>.</p>

<pre><code>root@k8s-master-6F403744-0:~/ingress/examples/deployment/nginx# kubectl get services --namespace kube-system -w
NAME                   CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
default-http-backend   10.0.113.185   &lt;none&gt;        80/TCP    42m
heapster   10.0.4.232   &lt;none&gt;    80/TCP    1h
kube-dns   10.0.0.10   &lt;none&gt;    53/UDP,53/TCP   1h
kubernetes-dashboard   10.0.237.125   &lt;nodes&gt;   80:32229/TCP   1h
nginx-ingress-ssl   10.0.92.57   40.71.37.243   443:30215/TCP   13m
</code></pre>

<p><a href="https://i.stack.imgur.com/jSxZ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jSxZ8.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/P1Gl9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P1Gl9.png" alt="enter image description here"></a></p>
