<p>im new to kubernetes and after researching a long time it seems im running out of resources so I'd be more than glad if somebody could help me.</p>
<h3>What I currently have</h3>
<ul>
<li>One Node that i am connecting to via SSH, bare-metal kubernetes setup (Notice that im <strong>not</strong> running k8s in the cloud)</li>
<li><code>kubectl version</code> yields <code>1.20</code> on Client and Server Side</li>
<li>NGINX Ingress Controller</li>
<li>Cluster setup with kubeadm</li>
<li>Following Pods, Services and one ingress resource (dashboard):</li>
</ul>
<p><strong>Pods</strong>:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>NAMESPACE</th>
<th>NAME</th>
<th>READY</th>
<th>STATUS</th>
<th>RESTARTS</th>
<th>AGE</th>
</tr>
</thead>
<tbody>
<tr>
<td>ingress-nginx</td>
<td>ingress-nginx-admission-create-4ml4p</td>
<td>0/1</td>
<td>Completed</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>ingress-nginx</td>
<td>ingress-nginx-admission-patch-jj9c6</td>
<td>0/1</td>
<td>Completed</td>
<td>1</td>
<td>23m</td>
</tr>
<tr>
<td>ingress-nginx</td>
<td>ingress-nginx-controller-67897c9494-kxwgv</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kube-system</td>
<td>coredns-74ff55c5b-2xbvq</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kube-system</td>
<td>coredns-74ff55c5b-sc667</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kube-system</td>
<td>etcd-k8s.mydomain.de</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kube-system</td>
<td>kube-apiserver-k8s.mydomain.de</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kube-system</td>
<td>kube-controller-manager-k8s.mydomain.de</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kube-system</td>
<td>kube-flannel-ds-fhzzp</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kube-system</td>
<td>kube-proxy-lq7tt</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kube-system</td>
<td>kube-scheduler-k8s.mydomain.de</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kubernetes-dashboard</td>
<td>dashboard-metrics-scraper-7b59f7d4df-v6qsn</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
<tr>
<td>kubernetes-dashboard</td>
<td>kubernetes-dashboard-74d688b6bc-5x4nd</td>
<td>1/1</td>
<td>Running</td>
<td>0</td>
<td>23m</td>
</tr>
</tbody>
</table>
</div>
<p><strong>Services</strong>:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>NAMESPACE</th>
<th>NAME</th>
<th>TYPE</th>
<th>CLUSTER-IP</th>
<th>EXTERNAL-IP</th>
<th>PORT(S)</th>
<th>AGE</th>
</tr>
</thead>
<tbody>
<tr>
<td>default</td>
<td>kubernetes</td>
<td>ClusterIP</td>
<td>10.96.0.1</td>
<td>none</td>
<td>443/TCP</td>
<td>33d</td>
</tr>
<tr>
<td>ingress-nginx</td>
<td>ingress-nginx-controller</td>
<td>NodePort</td>
<td>10.98.67.34</td>
<td>none</td>
<td>80:32346/TCP, 443:30710/TCP</td>
<td>33d</td>
</tr>
<tr>
<td>ingress-nginx</td>
<td>ingress-nginx-controller-admission</td>
<td>ClusterIP</td>
<td>10.110.196.58</td>
<td>none</td>
<td>443/TCP</td>
<td>33d</td>
</tr>
<tr>
<td>kube-system</td>
<td>kube-dns</td>
<td>ClusterIP</td>
<td>10.96.0.10</td>
<td>none</td>
<td>53/UDP,53/TCP, 9153/TCP</td>
<td>33d</td>
</tr>
<tr>
<td>kubernetes-dashboard</td>
<td>dashboard-metrics-scraper</td>
<td>ClusterIP</td>
<td>10.109.128.22</td>
<td>none</td>
<td>8000/TCP</td>
<td>33d</td>
</tr>
<tr>
<td>kubernetes-dashboard</td>
<td>kubernetes-dashboard</td>
<td>ClusterIP</td>
<td>10.98.158.159</td>
<td>none</td>
<td>443/TCP</td>
<td>33d</td>
</tr>
</tbody>
</table>
</div>
<p><strong>Ingress Resource</strong> (Dashboard):</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>NAMESPACE</th>
<th>NAME</th>
<th>CLASS</th>
<th>HOSTS</th>
<th>ADDRESS</th>
<th>PORTS</th>
<th>AGE</th>
</tr>
</thead>
<tbody>
<tr>
<td>kubernetes-dashboard</td>
<td>dashboard-ingress</td>
<td></td>
<td>dashboard.k8s.mydomain.de</td>
<td>10.10.1.164</td>
<td>80</td>
<td>52m</td>
</tr>
</tbody>
</table>
</div>
<p>When I try to reach the kubernetes dashboard using <code>https://dashboard.k8s.mydomain.de</code> nothing happens. When I try to reach it using <code>https://dashboard.k8s.mydomain.de:30710</code>, which is the HTTPS TCP Port of the nginx ingress controller, then it works. Its a non secure connection and the browser warns me, but it works. But obviously this is not the desired behavior.</p>
<h3>What i want to have</h3>
<p>I want to deploy the kubernetes dashboard in a way so that <code>https://dashboard.k8s.mydomain.de</code> gives access to the kubernetes dashboard over HTTPS. I don't know why this is currently not the case.</p>
<p>These are the configuration <code>.yaml</code> files i used for the deployments and stuff:</p>
<ul>
<li><p>NGINX Ingress Controller: <a href="https://github.com/kubernetes/ingress-nginx/blob/master/deploy/static/provider/baremetal/deploy.yaml" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx/blob/master/deploy/static/provider/baremetal/deploy.yaml</a></p>
</li>
<li><p>Kubernetes Dashboard: <a href="https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml" rel="nofollow noreferrer">https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml</a></p>
</li>
<li><p>Dashboard Ingress Resource:</p>
</li>
</ul>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: dashboard-ingress
  namespace: kubernetes-dashboard
  annotations:
    nginx.ingress.kubernetes.io/backend-protocol: HTTPS
spec:
  rules:
    - host: dashboard.k8s.mydomain.de
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: kubernetes-dashboard
                port:
                  number: 443
</code></pre>
<p>Logs of the nginx ingress controller tell me that it registers the ingress resource, so i am confused:</p>
<pre class="lang-sh prettyprint-override"><code>NGINX Ingress controller
  Release:       v0.44.0
  Build:         f802554ccfadf828f7eb6d3f9a9333686706d613
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: nginx/1.19.6
I0323 09:42:57.665847       6 flags.go:208] &quot;Watching for Ingress&quot; class=&quot;nginx&quot;
W0323 09:42:57.665953       6 flags.go:213] Ingresses with an empty class will also be processed by this Ingress controller

-------------------------------------------------------------------------------

W0323 09:42:57.667132       6 client_config.go:614] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0323 09:42:57.667958       6 main.go:241] &quot;Creating API client&quot; host=&quot;https://10.96.0.1:443&quot;
I0323 09:42:57.682847       6 main.go:285] &quot;Running in Kubernetes cluster&quot; major=&quot;1&quot; minor=&quot;20&quot; git=&quot;v1.20.3&quot; state=&quot;clean&quot; commit=&quot;01849e73f3c86211f05533c2e807736e776fcf29&quot; platform=&quot;linux/amd64&quot;
I0323 09:42:57.997597       6 main.go:105] &quot;SSL fake certificate created&quot; file=&quot;/etc/ingress-controller/ssl/default-fake-certificate.pem&quot;
I0323 09:42:58.003204       6 main.go:115] &quot;Enabling new Ingress features available since Kubernetes v1.18&quot;
W0323 09:42:58.008105       6 main.go:127] No IngressClass resource with name nginx found. Only annotation will be used.
I0323 09:42:58.033445       6 ssl.go:532] &quot;loading tls certificate&quot; path=&quot;/usr/local/certificates/cert&quot; key=&quot;/usr/local/certificates/key&quot;
I0323 09:42:58.070414       6 nginx.go:254] &quot;Starting NGINX Ingress controller&quot;
I0323 09:42:58.077773       6 event.go:282] Event(v1.ObjectReference{Kind:&quot;ConfigMap&quot;, Namespace:&quot;ingress-nginx&quot;, Name:&quot;ingress-nginx-controller&quot;, UID:&quot;a76c1e40-f5aa-4353-aeea-35bccbbb57a7&quot;, APIVersion:&quot;v1&quot;, ResourceVersion:&quot;3497961&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/ingress-nginx-controller
I0323 09:42:59.183747       6 event.go:282] Event(v1.ObjectReference{Kind:&quot;Ingress&quot;, Namespace:&quot;kubernetes-dashboard&quot;, Name:&quot;dashboard-ingress&quot;, UID:&quot;6f02c931-bfad-44a1-a219-4e2b2970365e&quot;, APIVersion:&quot;networking.k8s.io/v1beta1&quot;, ResourceVersion:&quot;3497191&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0323 09:42:59.271684       6 nginx.go:296] &quot;Starting NGINX process&quot;
I0323 09:42:59.271826       6 leaderelection.go:243] attempting to acquire leader lease ingress-nginx/ingress-controller-leader-nginx...
I0323 09:42:59.272447       6 nginx.go:316] &quot;Starting validation webhook&quot; address=&quot;:8443&quot; certPath=&quot;/usr/local/certificates/cert&quot; keyPath=&quot;/usr/local/certificates/key&quot;
I0323 09:42:59.272851       6 controller.go:146] &quot;Configuration changes detected, backend reload required&quot;
I0323 09:42:59.288414       6 leaderelection.go:253] successfully acquired lease ingress-nginx/ingress-controller-leader-nginx
I0323 09:42:59.288501       6 status.go:84] &quot;New leader elected&quot; identity=&quot;ingress-nginx-controller-67897c9494-kxwgv&quot;
I0323 09:42:59.302119       6 status.go:201] &quot;POD is not ready&quot; pod=&quot;ingress-nginx/ingress-nginx-controller-67897c9494-kxwgv&quot; node=&quot;k8s.mydomain.de&quot;
I0323 09:42:59.307191       6 status.go:281] &quot;updating Ingress status&quot; namespace=&quot;kubernetes-dashboard&quot; ingress=&quot;dashboard-ingress&quot; currentValue=[{IP:10.10.1.164 Hostname: Ports:[]}] newValue=[]
I0323 09:42:59.315053       6 event.go:282] Event(v1.ObjectReference{Kind:&quot;Ingress&quot;, Namespace:&quot;kubernetes-dashboard&quot;, Name:&quot;dashboard-ingress&quot;, UID:&quot;6f02c931-bfad-44a1-a219-4e2b2970365e&quot;, APIVersion:&quot;networking.k8s.io/v1beta1&quot;, ResourceVersion:&quot;3498054&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'Sync' Scheduled for sync
I0323 09:42:59.381846       6 controller.go:163] &quot;Backend successfully reloaded&quot;
I0323 09:42:59.382014       6 controller.go:174] &quot;Initial sync, sleeping for 1 second&quot;
I0323 09:42:59.382266       6 event.go:282] Event(v1.ObjectReference{Kind:&quot;Pod&quot;, Namespace:&quot;ingress-nginx&quot;, Name:&quot;ingress-nginx-controller-67897c9494-kxwgv&quot;, UID:&quot;2ba6f14e-36a8-401b-a1d8-00921cbe9604&quot;, APIVersion:&quot;v1&quot;, ResourceVersion:&quot;3497997&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
I0323 09:43:59.323910       6 status.go:281] &quot;updating Ingress status&quot; namespace=&quot;kubernetes-dashboard&quot; ingress=&quot;dashboard-ingress&quot; currentValue=[] newValue=[{IP:10.10.1.164 Hostname: Ports:[]}]
I0323 09:43:59.333091       6 event.go:282] Event(v1.ObjectReference{Kind:&quot;Ingress&quot;, Namespace:&quot;kubernetes-dashboard&quot;, Name:&quot;dashboard-ingress&quot;, UID:&quot;6f02c931-bfad-44a1-a219-4e2b2970365e&quot;, APIVersion:&quot;networking.k8s.io/v1beta1&quot;, ResourceVersion:&quot;3498144&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'Sync' Scheduled for sync
</code></pre>
<p>When i set up the cluster with microk8s instead of kubeadm it works.
Please specify what I have to do in order to make this work.</p>
<p>Thanks in Advance</p>

<p>Please run nginx ingress controller in hostNetwork Mode <a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#via-the-host-network" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#via-the-host-network</a></p>
<pre><code>template:
  spec:
    hostNetwork: true
</code></pre>
<p>And run it as DaemonSet.</p>
<p>And set dnsPolicy to ClusterFirstWithHostNet</p>
<p>Also, please read the security warnings in <a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#via-the-host-network" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#via-the-host-network</a></p>
<p>If you are using <a href="https://kubernetes.github.io/ingress-nginx/deploy/#using-helm" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/deploy/#using-helm</a> then add below to values file</p>
<pre><code>controller:
  dnsPolicy: ClusterFirstWithHostNet
  hostNetwork: true
  kind: DaemonSet
</code></pre>
