Skip to content

Instantly share code, notes, and snippets.

@dahlsailrunner
Last active August 13, 2024 10:48
Show Gist options
  • Select an option

  • Save dahlsailrunner/1a47b0e38f6e3ba64d4d61835c73b7e2 to your computer and use it in GitHub Desktop.

Select an option

Save dahlsailrunner/1a47b0e38f6e3ba64d4d61835c73b7e2 to your computer and use it in GitHub Desktop.
Helpful tips and snippets for Kubernetes within Docker Desktop

Using the K8s Dashboard Locally

Actual repo is here: https://github.com/kubernetes/dashboard

  1. Install the Dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.1.0/aio/deploy/recommended.yaml
  1. Create a Sample User Account that can Access the Dashboard via Token
kubectl apply -f https://gist.github.com/dahlsailrunner/bbd453f3bb6259b66c08a70d0908283f/raw/5727723217e2df4b65d8933adf04d009cfb0fe3f/local-dashboard-account.yml
  1. Grab the Token for the Sample User It's the token value from the output of the below command.
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | sls admin-user | ForEach-Object { $_ -Split '\s+' } | Select -First 1)
  1. Enable Access to the Dashboard Service
start kubectl proxy

Install the Community nginx Ingress Controller

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.43.0/deploy/static/provider/cloud/deploy.yaml
@farjaf
Copy link

farjaf commented Jan 7, 2022

I followed the tutorial from pluralsight and had the 404 ingress issue. Not entirely sure if that is related to yaml file or compatibility issue but replaced
kubectl apply -f https://gist.github.com/dahlsailrunner/bbd453f3bb6259b66c08a70d0908283f/raw/5727723217e2df4b65d8933adf04d009cfb0fe3f/local-dashboard-account.yml

with

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.4.0/aio/deploy/recommended.yaml

and can see the dashboard now.

@dahlsailrunner
Copy link
Author

Thanks for the note! You can also use Lens (https://k8slens.dev) as a way to visually navigate kubernetes resources, and that's easier than these steps (also allows more than one k8s cluster). The downside is that it's a local install.

@johscott
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment