Skip to content

onzyone/k8s-tilt

Repository files navigation

Overview

The goal for this is to setup a local env with a few tools like an ingress controller deployed with helm and hello world app

  1. Add a helm chart to the helm folder. I have added a stable folder too to indecate the state of the chart, this allows you to the have an incubator or test folder too.
  2. Each demo app has its own folder and there is a Tiltfile located in there ... as well as a main Tiltfile at the root of this repo

Confirmed working with:

  • kind: v0.8.1
  • tilt: v0.13.4

Table of Contents

Usage

  1. In the main Tiltfile there is a group of settings objects
    • settings is used to select what base infra to deploy, such as metallb, ambassador, valut, consul, etc
    • demo_settings is used to select what demo app you want to deploy
  2. note that helm tempates are converted into yaml and a kubectl apply is run on the yaml object, ie helm ls will not show anything
  3. note this Tiltfile assumes that you are running a local docker regestriy that is setup by this kind start script

Start

  1. Navigate to the root of this repo after you have cloned it and run tilt up
    • NOTE you can Start without hud, web gui, and watching your files tilt up --hud=false --no-browser --watch=false

Stop

  1. Either navigate to the root of this repo, or ctr x out of the tilt consule, and run tilt down

Demos

Ambassador (Ingress controller)

  1. get ingess ip kubectl get svc --namespace ambassador ambassador -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
  2. if running ambassador edge stack https://SERVICE_IP/edge_stack_admin/#dashboard

Ambassador (Quote App)

  1. get ingess ip INGRESS_IP=$(kubectl get svc --namespace ambassador ambassador -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
  2. check the quote :)
    curl -k https://${INGRESS_IP}/quote/
    {
        "server": "cavernous-grapefruit-wqjnlbct",
        "quote": "A small mercy is nothing at all?",
        "time": "2020-02-04T15:21:55.1482125Z"
    }

Basic Ingress Demo

  1. This demo builds the code located in the basic-ingress/src folder with the Dockerfile located in basic-ingress/
  2. Once the docker build is completed, Tilt will push the image into KIND, and deploy to k8s based on the files located in basic-ingress/k8s
  3. get ingess ip INGRESS_IP=$(kubectl get svc --namespace ambassador ambassador -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
  4. check the basicingress :)
    curl -k https://${INGRESS_IP}/basicingress/
    <!DOCTYPE html>
    <html>
    <head>
    <title>Basic Ingress Demo</title>
    </head>
    <body>
    <p>The data today is 04-02-2020</p>
    <p>The time right now is 15:30:03</p>
    <p>The pod IP is 10.244.3.5</p>
    </body>

Troubleshooting

  1. If you are having issues with local ingress on Mac OS, please look at this: k8s-kind Troubleshooting
  2. If local docker builds are working, but tilt builds are failing. Try to build the image with the following:
 $ tilt docker build .
 Running Docker command as:
 DOCKER_BUILDKIT=1 docker build .
 ---
 ...
  • If it still failed, you may need to export BOCKER_BUILDKIT=0

Reference Documentation:

Demo More Reading

Ambassador

Vault

consul

Dependency

  1. linux vm
  2. docker installed, as well as the ability to pull images from the internet
  3. kind installed
  • If you want a kind quick start you can look at my other repo: k8s-kind
  1. k8s tools (kubectl, helm 3 or greater)
  2. tilt installed