{"id":36105,"date":"2019-03-28T08:01:47","date_gmt":"2019-03-28T15:01:47","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/premier-developer\/?p=36105"},"modified":"2019-03-26T08:14:16","modified_gmt":"2019-03-26T15:14:16","slug":"bypassing-authentication-for-the-local-kubernetes-cluster-dashboard","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/bypassing-authentication-for-the-local-kubernetes-cluster-dashboard\/","title":{"rendered":"Bypassing authentication for the local Kubernetes Cluster Dashboard"},"content":{"rendered":"<p>Premier Developer Consultant <a href=\"https:\/\/www.linkedin.com\/in\/randyrpatterson\/\" target=\"_blank\" rel=\"noopener\">Randy Patterson<\/a> shares a tip to bypass authentication for the local Kubernetes Cluster Dashboard.<\/p>\n<hr \/>\n<p>It\u2019s no secret that you can run a <a href=\"https:\/\/docs.docker.com\/docker-for-windows\/\">local version of Kubernetes<\/a> on Docker Desktop for Windows, however, getting the Dashboard installed and configured correctly can be challenging. The problem is that the default installation requires you to manage an admin user and copy that user&#8217;s bearer token into the portal to login. This process is fine for shared clusters but for a local cluster it just makes using the dashboard cumbersome. Fortunately, there is an easy workaround and this blog post will guide you through the process.<\/p>\n<p>Once your local Kubernetes cluster is up and running, it\u2019s time to configure and install the dashboard with the ability to skip the login process.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-36107\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/03\/kub1.png\" alt=\"\" width=\"832\" height=\"573\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/03\/kub1.png 832w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/03\/kub1-300x207.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/03\/kub1-768x529.png 768w\" sizes=\"(max-width: 832px) 100vw, 832px\" \/><\/p>\n<p>At the time of this writing the released version of the dashboard was <strong>1.10.1<\/strong>, check the <a href=\"https:\/\/github.com\/kubernetes\/dashboard#getting-started\">Github<\/a> page for the latest version<\/p>\n<p>First, open a PowerShell prompt and download the latest Kubernetes Dashboard YAML file.<\/p>\n<pre class=\"lang:default decode:true \">Invoke-WebRequest -Uri https:\/\/raw.githubusercontent.com\/kubernetes\/dashboard\/v1.10.1\/src\/deploy\/recommended\/kubernetes-dashboard.yaml -OutFile kubernetes-dashboard.yaml<\/pre>\n<p>Next, open the downloaded file in your favorite text editor, I\u2019ll use VS Code.<\/p>\n<pre class=\"lang:default decode:true\">code .\\kubernetes-dashboard.yaml<\/pre>\n<p>Locate the <em>container -&gt; args<\/em> section under the <em>Dashboard-Deployment<\/em> section (around line 116) and add the following command line arguments:<\/p>\n<pre class=\"lang:default decode:true\">--enable-skip-login\r\n--disable-settings-authorizer<\/pre>\n<p>Your modified args section should look like the following<\/p>\n<pre class=\"lang:default decode:true \">spec:\r\n      containers:\r\n      - name: kubernetes-dashboard\r\n        image: k8s.gcr.io\/kubernetes-dashboard-amd64:v1.10.1\r\n        ports:\r\n        - containerPort: 8443\r\n          protocol: TCP\r\n        args:\r\n          - --enable-skip-login\r\n          - --disable-settings-authorizer        \r\n          - --auto-generate-certificates\r\n          # Uncomment the following line to manually specify Kubernetes API server Host\r\n          # If not specified, Dashboard will attempt to auto discover the API server and connect\r\n          # to it. Uncomment only if the default does not work.\r\n          # - --apiserver-host=http:\/\/my-address:port\r\n        volumeMounts:\r\n        - name: kubernetes-dashboard-certs\r\n          mountPath: \/certs\r\n<\/pre>\n<p>Save your changes and exit the text editor then install the dashboard from a PowerShell prompt in the same directory as the kubernetes-dashboard.yaml file:<\/p>\n<pre class=\"lang:default decode:true \">kubectl apply -f .\\kubernetes-dashboard.yaml<\/pre>\n<p>The output should look something like this:<\/p>\n<pre class=\"lang:default decode:true\">secret \"kubernetes-dashboard-certs\" created\r\nserviceaccount \"kubernetes-dashboard\" created\r\nrole.rbac.authorization.k8s.io \"kubernetes-dashboard-minimal\" created\r\nrolebinding.rbac.authorization.k8s.io \"kubernetes-dashboard-minimal\" created\r\ndeployment.apps \"kubernetes-dashboard\" created\r\nservice \"kubernetes-dashboard\" created<\/pre>\n<p>Finally, connect to the dashboard proxy<\/p>\n<pre class=\"lang:default decode:true \">kubectl proxy<\/pre>\n<p>then navigate to web site:<\/p>\n<p><a href=\"http:\/\/localhost:8001\/api\/v1\/namespaces\/kube-system\/services\/https:kubernetes-dashboard:\/proxy\/\">http:\/\/localhost:8001\/api\/v1\/namespaces\/kube-system\/services\/https:kubernetes-dashboard:\/proxy\/<\/a><\/p>\n<p>You can now skip the login process and navigate directly to the Dashboard Overview<\/p>\n<p><img decoding=\"async\" width=\"1557\" height=\"710\" class=\"wp-image-36106\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/03\/c-users-ranpat-appdata-local-temp-snaghtmle3395f6.png\" alt=\"C:\\Users\\ranpat\\AppData\\Local\\Temp\\SNAGHTMLe3395f6.PNG\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/03\/c-users-ranpat-appdata-local-temp-snaghtmle3395f6.png 1557w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/03\/c-users-ranpat-appdata-local-temp-snaghtmle3395f6-300x137.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/03\/c-users-ranpat-appdata-local-temp-snaghtmle3395f6-768x350.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/03\/c-users-ranpat-appdata-local-temp-snaghtmle3395f6-1024x467.png 1024w\" sizes=\"(max-width: 1557px) 100vw, 1557px\" \/><\/p>\n<p>This configuration option can be used on any Kubernetes Dashboard installation including Windows or Linux deployments. Bypassing the dashboard authentication can be a real time saver when testing with the locally deployed Kubernetes cluster.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It\u2019s no secret that you can run a local version of Kubernetes on Docker Desktop for Windows, however, getting the Dashboard installed and configured correctly can be challenging. The problem is that the default installation requires you to manage an admin user and copy that user&#8217;s bearer token into the portal to login.<\/p>\n","protected":false},"author":582,"featured_media":36108,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[126],"tags":[92,314,3],"class_list":["post-36105","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kubernetes","tag-kubernetes","tag-randy-patterson","tag-team"],"acf":[],"blog_post_summary":"<p>It\u2019s no secret that you can run a local version of Kubernetes on Docker Desktop for Windows, however, getting the Dashboard installed and configured correctly can be challenging. The problem is that the default installation requires you to manage an admin user and copy that user&#8217;s bearer token into the portal to login.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/36105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=36105"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/36105\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/36108"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=36105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=36105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=36105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}