<p>I've installed Kubernetes on ubuntu 18.04 using <a href="https://phoenixnap.com/kb/install-kubernetes-on-ubuntu" rel="nofollow noreferrer">this article</a>. Everything is working fine and then I tried to install Kubernetes dashboard with <a href="https://github.com/kubernetes/dashboard" rel="nofollow noreferrer">these instructions</a>. </p>

<p>Now when I am trying to run <code>kubectl proxy</code> then the dashboard is not cumming up and it gives following error message in the browser when trying to access it using default kubernetes-dashboard URL.</p>

<p><a href="http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/" rel="nofollow noreferrer">http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/</a></p>

<pre><code>{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "no endpoints available for service \"https:kubernetes-dashboard:\"",
  "reason": "ServiceUnavailable",
  "code": 503
}
</code></pre>

<p>Following commands give this output where kubernetes-dashboard shows status as CrashLoopBackOff</p>

<p>$> kubectl get pods --all-namespaces</p>

<pre><code>NAMESPACE              NAME                                         READY   STATUS             RESTARTS   AGE
default                amazing-app-rs-59jt9                         1/1     Running            5          23d
default                amazing-app-rs-k6fg5                         1/1     Running            5          23d
default                amazing-app-rs-qd767                         1/1     Running            5          23d
default                amazingapp-one-deployment-57dddd6fb7-xdxlp   1/1     Running            5          23d
default                nginx-86c57db685-vwfzf                       1/1     Running            4          22d
kube-system            coredns-6955765f44-nqphx                     0/1     Running            14         25d
kube-system            coredns-6955765f44-psdv4                     0/1     Running            14         25d
kube-system            etcd-master-node                             1/1     Running            8          25d
kube-system            kube-apiserver-master-node                   1/1     Running            42         25d
kube-system            kube-controller-manager-master-node          1/1     Running            11         25d
kube-system            kube-flannel-ds-amd64-95lvl                  1/1     Running            8          25d
kube-system            kube-proxy-qcpqm                             1/1     Running            8          25d
kube-system            kube-scheduler-master-node                   1/1     Running            11         25d
kubernetes-dashboard   dashboard-metrics-scraper-7b64584c5c-kvz5d   1/1     Running            0          41m
kubernetes-dashboard   kubernetes-dashboard-566f567dc7-w2sbk        0/1     CrashLoopBackOff   12         41m
</code></pre>

<p>$> kubectl get services --all-namespaces</p>

<pre><code>NAMESPACE              NAME                        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
default                kubernetes                  ClusterIP   ----------      &lt;none&gt;        443/TCP                  25d
default                nginx                       NodePort    ----------    &lt;none&gt;        80:32188/TCP             22d
kube-system            kube-dns                    ClusterIP   ----------      &lt;none&gt;        53/UDP,53/TCP,9153/TCP   25d
kubernetes-dashboard   dashboard-metrics-scraper   ClusterIP   ----------   &lt;none&gt;        8000/TCP                 24d
kubernetes-dashboard   kubernetes-dashboard        ClusterIP   ----------    &lt;none&gt;        443/TCP                  24d



$ kubectl get services --all-namespaces
NAMESPACE              NAME                        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
default                kubernetes                  ClusterIP   ======       &lt;none&gt;        443/TCP                  25d
default                nginx                       NodePort    ======    &lt;none&gt;        80:32188/TCP             22d
kube-system            kube-dns                    ClusterIP   ======      &lt;none&gt;        53/UDP,53/TCP,9153/TCP   25d
kubernetes-dashboard   dashboard-metrics-scraper   ClusterIP   ======   &lt;none&gt;        8000/TCP                 24d
kubernetes-dashboard   kubernetes-dashboard        ClusterIP   ======    &lt;none&gt;        443/TCP                  24d
</code></pre>

<p>$ kubectl get events -n kubernetes-dashboard</p>

<pre><code>LAST SEEN   TYPE      REASON    OBJECT                                      MESSAGE
24m         Normal    Pulling   pod/kubernetes-dashboard-566f567dc7-w2sbk   Pulling image "kubernetesui/dashboard:v2.0.0-rc2"
4m46s       Warning   BackOff   pod/kubernetes-dashboard-566f567dc7-w2sbk   Back-off restarting failed container
</code></pre>

<p>$ kubectl describe services kubernetes-dashboard -n kubernetes-dashboard </p>

<pre><code>Name:              kubernetes-dashboard
Namespace:         kubernetes-dashboard
Labels:            k8s-app=kubernetes-dashboard
Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                     {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"k8s-app":"kubernetes-dashboard"},"name":"kubernetes-dashboard"...
Selector:          k8s-app=kubernetes-dashboard
Type:              ClusterIP
IP:                10.96.241.62
Port:              &lt;unset&gt;  443/TCP
TargetPort:        8443/TCP
Endpoints:         
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>

<p>$ kubectl logs kubernetes-dashboard-566f567dc7-w2sbk -n kubernetes-dashboard</p>

<pre><code>&gt; 2020/01/29 16:00:34 Starting overwatch 2020/01/29 16:00:34 Using
&gt; namespace: kubernetes-dashboard 2020/01/29 16:00:34 Using in-cluster
&gt; config to connect to apiserver 2020/01/29 16:00:34 Using secret token
&gt; for csrf signing 2020/01/29 16:00:34 Initializing csrf token from
&gt; kubernetes-dashboard-csrf secret panic: Get
&gt; https://10.96.0.1:443/api/v1/namespaces/kubernetes-dashboard/secrets/kubernetes-dashboard-csrf:
&gt; dial tcp 10.96.0.1:443: i/o timeout
&gt; 
&gt; goroutine 1 [running]:
&gt; github.com/kubernetes/dashboard/src/app/backend/client/csrf.(*csrfTokenManager).init(0xc0003dac80)
&gt;         /home/travis/build/kubernetes/dashboard/src/app/backend/client/csrf/manager.go:40
&gt; +0x3b4 github.com/kubernetes/dashboard/src/app/backend/client/csrf.NewCsrfTokenManager(...)
&gt;         /home/travis/build/kubernetes/dashboard/src/app/backend/client/csrf/manager.go:65
&gt; github.com/kubernetes/dashboard/src/app/backend/client.(*clientManager).initCSRFKey(0xc000534200)
&gt;         /home/travis/build/kubernetes/dashboard/src/app/backend/client/manager.go:494
&gt; +0xc7 github.com/kubernetes/dashboard/src/app/backend/client.(*clientManager).init(0xc000534200)
&gt;         /home/travis/build/kubernetes/dashboard/src/app/backend/client/manager.go:462
&gt; +0x47 github.com/kubernetes/dashboard/src/app/backend/client.NewClientManager(...)
&gt;         /home/travis/build/kubernetes/dashboard/src/app/backend/client/manager.go:543
&gt; main.main()
&gt;         /home/travis/build/kubernetes/dashboard/src/app/backend/dashboard.go:105
&gt; +0x212
</code></pre>

<p>Any suggestions to fix this? Thanks in advance.</p>

<p>I noticed that the guide You used to install kubernetes cluster is missing one important part.</p>

<p>According to kubernetes documentation:</p>

<blockquote>
  <p>For  <code>flannel</code>  to work correctly, you must pass  <code>--pod-network-cidr=10.244.0.0/16</code>  to  <code>kubeadm init</code>.</p>
  
  <p>Set  <code>/proc/sys/net/bridge/bridge-nf-call-iptables</code>  to  <code>1</code>  by running  <code>sysctl net.bridge.bridge-nf-call-iptables=1</code>  to pass bridged IPv4 traffic to iptables’ chains. This is a requirement for some CNI plugins to work, for more information please see  <a href="https://kubernetes.io/docs/concepts/cluster-administration/network-plugins/#network-plugin-requirements" rel="nofollow noreferrer">here</a>.</p>
  
  <p>Make sure that your firewall rules allow UDP ports 8285 and 8472 traffic for all hosts participating in the overlay network. see  <a href="https://coreos.com/flannel/docs/latest/troubleshooting.html#firewalls" rel="nofollow noreferrer">here</a> .</p>
  
  <p>Note that  <code>flannel</code>  works on  <code>amd64</code>,  <code>arm</code>,  <code>arm64</code>,  <code>ppc64le</code>  and  <code>s390x</code>  under Linux. Windows (<code>amd64</code>) is claimed as supported in v0.11.0 but the usage is undocumented.</p>
  
  <pre class="lang-sh prettyprint-override"><code>kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
</code></pre>
  
  <p>For more information about  <code>flannel</code>, see  <a href="https://github.com/coreos/flannel" rel="nofollow noreferrer">the CoreOS flannel repository on GitHub</a> .</p>
</blockquote>

<p>To fix this:</p>

<p>I suggest using the command:</p>

<pre><code>sysctl net.bridge.bridge-nf-call-iptables=1
</code></pre>

<p>And then reinstall flannel:</p>

<pre><code>kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
</code></pre>

<pre><code>kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
</code></pre>

<hr>

<p>Update: After verifying the the <code>/proc/sys/net/bridge/bridge-nf-call-iptables</code> value is <code>1</code> by default <code>ubuntu-18-04-lts</code>. So issue here is You need to access the dashboard locally.</p>

<p>If You are connected to Your master node via ssh. It could be possible to use <code>-X</code> flag with ssh in order to launch we browser via <code>ForwardX11</code>. Fortunately <code>ubuntu-18-04-lts</code> has it turned on by default.</p>

<pre><code>ssh -X server
</code></pre>

<p>Then install local web browser like chromium.</p>

<pre><code>sudo apt-get install chromium-browser
</code></pre>

<pre><code>chromium-browser
</code></pre>

<p>And finally access the dashboard locally from node. </p>

<pre><code>http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
</code></pre>

<p>Hope it helps.</p>
