Jonathan Altman

Dotcom Thousandaire

October 29, 2020

TL;DR & Rationale

Using waypoint on your local machine via minikube is not that hard, but there are a few extra steps if:

  • You don't want to use their public service to publish URLs to your service
  • You want to use minikube (this may be an issue with kind too) and make sure container images are available. The Hashicorp docs are written assuming kind. I have not actually tested it out so I do not know if the things I had to do for minikube like enabling ingress or the eval to get minikube docker-env stuff set up are things that kind just does, or there are analagous commands you would need for it
  • You want to expose your services outside the cluster without the public service

Setting things up as described below will give you a standalone waypoint configuration on your local machine via minikube without using the external URL service but with the ability to access services you deploy from the host.

Recipe

Bring minikube up

  • Install minikube. I used homewbrew to do that
  • Bring your cluster up. I wanted to make sure I had the current one as of the day I did this, which was 1.19.2, so I did minikube start --kubernetes-version=v1.19.2. Replace with a specific/current/later version in the future if you want it, and especially after 1.19.2 is no longer supported
  • Make sure your cluster comes up
  • Make sure you have the minikube ingress capability enabled so that exposing your waypoint service to the host works: minikube addons enable ingress

EVERY TIME YOU START A NEW SHELL AND WANT TO USE WAYPOINT

This was the critical missing step for me.

You must run eval $(minikube docker-env)

This will point your minikube k8s cluster's configuration to docker's local registry to pull container images from. Without that, waypoint will not work right on minikube. When you see ImagePull errors on waypoint deploy or waypoint up attempts that is your indication that you have forgotten this step..

Bringing waypoint up

  • Follow the normal install to get the waypoint executable installed, as shown in their documentation, which on OSX is via homebrew
  • Make a directory where you want the waypoint configuration information to live (the .db files you see in their instructions for running the server manually via waypoint server run ...
  • Start up the server: waypoint server run -db=waypoint-k8s.db -url-enabled=false &. The name for the db files is arbitrary. I used waypoint-k8s so that if I wanted to have alternate configurations like only docker or aks or ecs I could do it easily enough
  • Observe the waypoint server bootstrap command that gets output by the waypoint server run ... command, and execute it (copy and paste is nice here!). On my machine the command that came up was waypoint server bootstrap -server-addr=127.0.0.1:9701 -server-tls-skip-verify but yours may be different

Deploy an App

I used the nodejs example app that Hashicorp distributes for waypoint. It has a kubernetes flavor. These steps should get the sample nodejs app up and running:

  • Follow the instructions on the Waypoint tutorial section to get their samples installed: Clone the examples repository
  • Skip the following sections on that tutorial page about setting up kind and bootstrapping waypoint itself
  • Pick up the tutorial from the section Initialize Waypoint
  • If the tutorial shows instructions for different flavors, just follow the instructions for kind and it will work just fine.

Expose Your App Via Ingress

Once your app is deployed for the first time, if you want it accessible outside your minikube k8s cluster, you can use k8s ingress to expose it to the host machine. To do that, assuming the waypoint service you deployed was named example-nodejs you would issue the following command:

echo "apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: example-nodejs-ingress spec: defaultBackend: service: name: example-nodejs port: number: 80" | kubectl apply -f -

Replace example-nodejs with whatever you did name your service if you did give it a different name.

Accessing Your Service Via Ingress

Find the ip address of your minikube cluster via minikube ip. Your service should be available via http over that IP address (on port 80).

Deleting the Ingress

You will need to do this before you can waypoint destroy your waypoint-based service

kubectl delete ingress example-nodejs-ingress

Gets rid of the ingress named example-nodejs-ingress as used in the section above. If you named your ingress differently when you created it, use whatever name you used intead.