ansidev / k3d-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

k3d-demo

Introduction

This project demonstrates how to setup a local k8s cluster (specifically on macOS) using k3d.

Usages

Make sure brew and docker is installed.

  1. Install tools:

    make prepare
  2. Make sure Docker is already running, then deploy k3s cluster using one of following commands:

    task single-node:deploy
    task multi-nodes:deploy
    task multi-nodes-ingress-nginx:deploy

    NOTE: Kubernetes dashboard will be enabled by default.

  3. Wait until the cluster reaches the Running state, then open Kubernetes dashboard and paste the bearer token into the form to login (The bearer token will be copied to clipboard automatically).

    task dashboard:open

    To get the bearer token, run

    task dashboard:get-admin-token
  4. Deploy an example app to k3s

    task deploy-app -- http_echo.yaml

    NOTE: The default namespace for app will be k3s-local and can be customized via Taskfile.yaml variable KUBE_NAMESPACE.

    If you deploy the k3s cluster using task multi-nodes-ingress-nginx:deploy, use the below command:

    task deploy-app -- http_echo_ingress_nginx.yaml
  5. Test app

    curl --resolve k3s.local:8080:127.0.0.1 http://k3s.local:8080/

    You should see this result:

    hello
    

Author

Le Minh Tri @ansidev.

License

This source code is released under the MIT License.

About

License:MIT License


Languages

Language:Makefile 100.0%