K8 Dashboard on Docker Desktop

what’s going on

Published November 28, 2021 #kubernetes, #docker

Pretty easy to setup, but here are the steps.

Docker Desktop

To easily get going on a local Mac, you can install the compoents using homebrew.

  brew install --cask docker
  brew install kubernetes-cli
  brew install kn

Start up Docker, and then turn on kubernetes and make sure that you have a running node.

  kubectl get nodes
NAME             STATUS   ROLES                  AGE     VERSION
docker-desktop   Ready    control-plane,master   5h59m   v1.21.5

Install kubenetes dashboard

It's nice to have a local dashboard to see whats' going on.

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

Then create a service account account.yaml:

  apiVersion: v1
  kind: ServiceAccount
    name: admin-user
    namespace: kubernetes-dashboard
  apiVersion: rbac.authorization.k8s.io/v1
  kind: ClusterRoleBinding
    name: admin-user
    apiGroup: rbac.authorization.k8s.io
    kind: ClusterRole
    name: cluster-admin
  - kind: ServiceAccount
    name: admin-user
    namespace: kubernetes-dashboard

Apply it:

  kubectl apply -f account.yaml

Then you can get the token into your clipboard:

  kubectl -n kubernetes-dashboard get secret \
          $(kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath="{.secrets[0].name}") \
          -o go-template="{{.data.token | base64decode}}" | \

Finally, setup a proxy to access the dashboard:

kubectl proxy &

And point your browser to http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

Read next

See also

Rails on Kubernetes with TLS


I wanted to see how to really use kubernetes like I'm used to using heroku, so lets recreate everything using terraform, digital ocean, kubernetes and MAGIC! Sample rails app Build image First thing we'll do is to create a docker image that we'll use to build our rails app. Dockerfile.build: FROMruby:3.0.1WORKDIR/app# nodejs and yarn and clocRUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -RUN echo "deb https://dl.

Read more

Deploying OpenFaaS on Digital Ocean with Terraform

Everything functional

We are going to look at how to use Terraform to deploy a Kubernetes cluster on Digital Ocean, add a managed postgres database, and redis and OpenFaaS in kubernetes. This will show how to use Terraform to manage the configuration and how we can access both cloud and kubernetes managed services from OpenFaaS functions. We are going to use the digitalocean, kubernetes, and helm terraform providers. The plan Provision a digitalocean_kubernetes_cluster Provision a digitalocean_database_cluster Provision 2 kubernetes_namespace for openfaas and openfaas-fn Provision a helm_release for openfaas Provision a helm_release for redis Provision 2 kubernetes_secret to point to the databases Deploy an OpenFaaS function that reads those secrets and talks to the database.

Read more

Controlling docker in golang

So meta

I've been thinking about running different ephemeral jobs with attached volumes, volumes that I could garbage collect as needed. This is a non-standard way of using docker, but I wanted to look to see how I could interact with the docker daemon programatically. The use case is: Create a docker volume for a container Start up a docker container, with a specified environment Monitor the running of the container, kill if its running for too long Capture the output of the container Clean up the container Pull data from the volume Clean up the volume Setting up go environemnt First we need to setup a go project and create the go.

Read more