Skip to content

TortleWortle/DigitalOcean-Kubernetes-Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DigitalOcean-Kubernetes-Challenge

This is my repo for the DigitalOcean Kubernetes Challenge If you find any inaccuracies in my explanations or useless / wrong configuration please let me know in an issue so I can learn from my mistakes :)

Goals

My goals for this project were the following: Learn how to use kubernetes and understanding how to use helm.

  • Installing an image repository (Harbor)
  • Installing and understanding ingresses
  • Stapling more tech onto it for a functioning cluster

What I've learned

  • How to use digitalocean's kubernetes service.
  • Using helm charts to install and override values.
  • That Harbor is really cool, relatively "easy" to get started with and looks amazing.
  • Installing and using traefik as an ingress controller
  • Migrating from a local cluster to digitalocean's Kubernetes was really smooth

Tech discovered

Harbor is pretty amazing, I've searched for registries in the past and Harbor was relatively painless and looks amazing.

Helm is fantastic, I'm yet to write my own proper helm charts but I'm definitely using it when I use Kubernetes more.

Kubernetes (ish) I've played with Kubernetes a little before but I've discovered so much more about it and got a lot more use out of it during this challenge.

Mistakes I've made

Don't forget to add labels to your pods, I spend hours trying to figure out why the service selector wasn't working.

Helm upgrading with different encryption keys can lead to some weird behaviour (please correct me if I'm wrong)

Not adding appropiate annotations to change how the ingress functions.

Setup

Setup Traefik Ingress

helm install \
--namespace traefik \
--create-namespace \
--values charts/traefik/values.yml \
traefik traefik/traefik

Setup Harbor (Don't forget to change the username/password combination)

Generate Initial Admin password and view it

HARBORPASS=$(openssl rand -hex 8)
echo $HARBORPASS
HARBORKEY=$(openssl rand -hex 8)
helm install \
--namespace harbor \
--create-namespace \
--values charts/harbor/values.yml \
--set-string "secretKey=$HARBORKEY" \
--set-string "harborAdminPassword=$HARBORPASS" \
harbor harbor/harbor

Don't forget to use the same secretKey when doing a helm upgrade. Because I did and everything broke :)

Example nginx website

kubectl apply -f yml/nginx-example.yml

Local traefik dashboard at traefik.localhost

kubectl apply -f yml/traefik-dashboard.yml

This was only useful in local development and I used kubectl port-forward to debug in "prod"

Deployed Examples

Resources