4 differently-colored macarons photographed up-close
4 differently-colored macarons photographed up-close
(Source)

Intro

A while ago, I wanted to do get some more experience with Kubernetes. Even though managed cloud environments can be great and very helpful, I just wanted to get down to business and run the thing locally.

I’ve spent some time reading and researching the different possibilities and in the end decided to run k3d.

Why?

K3d is k3s in Docker. k3s is k8s with some unnecessary stuff stripped out (“it’s 5 less complex/size-heavy than k8s”). K3s runs on linux, but not on MacOS. So to run it on a MacBook, running it in Docker would work. …


Poster for the Double Dragon video game from ‘87
Poster for the Double Dragon video game from ‘87

Kubernetes dashboard

In case you want to see more about what’s happening in the cluster, you can run the k8s dashboard as follows (source):

GITHUB_URL=https://github.com/kubernetes/dashboard/releasesVERSION_KUBE_DASHBOARD=$(curl -w '%{url_effective}' -I -L -s -S ${GITHUB_URL}/latest -o /dev/null | sed -e 's|.*/||')kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml

Then, create dashboard.admin-user.yml and dashboard.admin-user-role.yml with the content specified here.

Lastly, run:

kubectl create -f dashboard.admin-user.yml -f dashboard.admin-user-role.yml
kubectl -n kubernetes-dashboard describe secret admin-user-token | grep ^token
kubectl proxy

You can now open the k8s dashboard at http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/ and sign in with user admin-user and as password the token grepped in the previous step.

Traefik dashboard

To troubleshoot traefik, it’s sometimes easiest to view the traefik dashboard.

For that, do the following:

Run kubectl -n kube-system edit configmap traefik, then add:

[api]
dashboard = true

Then run a proxy (kubectl -n kube-system port-forward deployment/traefik 8080) and open http://localhost:8080 to load the traefik dashboard.


Earth

Inspiration hit when reading Scott Hanselman’s post about renaming the master branch to main to make our language as tech sector more inclusive.

To make this operation easier, here’s a small script to run for easily renaming the master branch to ‘main’ for any git project:

Couple of caveats:

  • A manual step is needed in the middle of the script to update the default branch to main
  • Only tested on Mac OS, will probably fail on Unix due to sed differences
  • Only works for GitHub-tracked projects

Feedback?

Send it my way! You can find me on Twitter.


Two children looking out over a green field with some trees in the background.
Two children looking out over a green field with some trees in the background.

Last week, I realized I made commits to some of my pet projects with my work email instead of my private email.

This is a problem because:

A. I did not work on those pet projects during as part of my regular work

B. I don’t necessarily want to expose my work email

Luckily, others have already run into this problem and how to fix it.

For just fixing your most recent commit, run:

git commit — amend — author=”NAME <EMAIL>”

In case you want to fix multiple commits, it’s easier to run a small script:

In my case…

Geert Gerritsen

Freelance backend developer. Follow me on Twitter where I tweet about software, productivity and golang, among other things.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store