Code Monkey home page Code Monkey logo

bekind's Introduction

BeKind

Installs a K8S cluster using KIND, and does a number of post deployment steps.

Bekind will:

  • Install a KIND cluster based on the supplied config
  • KIND cluster can be modified to deploy a specific K8S version
  • Installs any Supplied Helm Charts
  • Loads images into the KIND cluster

Installation

Prerequisites:

Install with:

go install github.com/christianh814/bekind@latest

Then move into your $PATH (example showing /usr/local/bin)

sudo mv $GOBIN/bekind /usr/local/bin/bekind
sudo chmod +x /usr/local/bin/bekind

Config

You can customize the setup by providing a Specific Config (under ~/.bekind/config.yaml or by providing --config to a YAML file)

For example:

  • domain: Domain to use for any ingresses this tool will autocreate, assuming wildcard DNS (currently unused/ignored)
  • kindImageVersion: The KIND Node image to use (You can find a list on dockerhub). You can also supply your own public image or a local image.
  • kindConfig: A custom kind config. It's "garbage in/garbage out".
  • helmCharts: Different Helm Charts to install on startup. "garbage in/garbage out". See Helm Chart Config for more info.
  • loadDockerImages: List of images to load onto the nodes (NOTE images must exist locally, so a "pull" is performed). Only docker is supported (see KIND upstream issue)
  • postInstallManifests: List of YAML files to apply to the KIND cluster after setup. This is the last step to run in the process. There is no checks done and any errors are from the K8S API. Currently only YAML files are supported. It's "garbage in/garbage out".
domain: "7f000001.nip.io"
kindImageVersion: "kindest/node:v1.29.1"
helmCharts:
  - url: "https://kubernetes.github.io/ingress-nginx"
    repo: "ingress-nginx"
    chart: "ingress-nginx"
    release: "nginx-ingress"
    namespace: "ingress-controller"
    args:
      - name: 'controller.hostNetwork'
        value: "true"
      - name: 'controller.nodeSelector.nginx'
        value: "ingresshost"
      - name: 'controller.service.type'
        value: "ClusterIP"
      - name: 'controller.tolerations[0].operator'
        value: "Exists" - name: 'controller.service.externalTrafficPolicy'
        value: ""
      - name: 'controller.extraArgs.enable-ssl-passthrough'
        value: ""
    wait: true
  - url: "https://argoproj.github.io/argo-helm"
    repo: "argo"
    chart: "argo-cd"
    release: "argocd"
    namespace: "argocd"
    args:
      - name: 'server.ingress.enabled'
        value: "true"
      - name: 'server.ingress.hosts[0]'
        value: "argocd.7f000001.nip.io"
      - name: 'server.ingress.ingressClassName'
        value: "nginx"
      - name: 'server.ingress.https'
        value: "true"
      - name: 'server.ingress.annotations."nginx\.ingress\.kubernetes\.io/ssl-passthrough"'
        value: "true"
      - name: 'server.ingress.annotations."nginx\.ingress\.kubernetes\.io/force-ssl-redirect"'
        value: "true"
    wait: true
  - url: "https://redhat-developer.github.io/redhat-helm-charts"
    repo: "redhat-helm-charts"
    chart: "quarkus"
    release: "myapp"
    namespace: "demo"
    version: "0.0.3"
    args:
      - name: 'build.enabled'
        value: "false"
      - name: 'deploy.route.enabled'
        value: "false"
      - name: 'image.name' 
        value: "quay.io/ablock/gitops-helm-quarkus"
    wait: true
  - url: "oci://ghcr.io/akuity/kargo-charts/kargo"
    repo: "kargo"
    chart: "kargo"
    release: "kargo"
    namespace: "kargo"
    args: 
      - name: 'api.adminAccount.password'
        value: "admin"
      - name: 'controller.logLevel'
        value: "DEBUG"
      - name: 'api.adminAccount.tokenTTL'
        value: "24h"
      - name: 'api.adminAccount.tokenSigningKey'
        value: "secret"
    wait: true
kindConfig: |
  kind: Cluster
  apiVersion: kind.x-k8s.io/v1alpha4
  networking:
    podSubnet: "10.254.0.0/16"
    serviceSubnet: "172.30.0.0/16"
  nodes:
  - role: control-plane
    kubeadmConfigPatches:
    - |
      kind: InitConfiguration
      nodeRegistration:
        kubeletExtraArgs:
          node-labels: "nginx=ingresshost"
    extraPortMappings:
    - containerPort: 80
      hostPort: 80
      listenAddress: 0.0.0.0
    - containerPort: 443
      hostPort: 443
      listenAddress: 0.0.0.0
loadDockerImages:
  - gcr.io/kuar-demo/kuard-amd64:blue
postInstallManifests:
  - 'file:///path/to/local/k8s/file.yaml'
  - 'https://raw.githubusercontent.com/christianh814/gitops-examples/main/gobg/gobg.yaml'

Helm Chart Config

The following are valid configurations for the helmCharts section:

  • url: The URL of the Helm repo (REQUIRED). Can be OCI repo with oci://
  • repo: What to name the repo, interally (REQUIRED). It's the <reponame> from helm repo add <reponame> <url>. (ignored when using OCI)
  • chart: What chart to install from the Helm repo (REQUIRED). (Ignored when using OCI)
  • release: What to call the release when it's installed (REQUIRED).
  • namespace: The namespace to install the release to, it'll create the namespace if it's not already there (REQUIRED).
  • version: The version of the Helm chart to install (Optional)
  • args: The parameter of the --set command to change the values in a comma separated format. This is a list of key value pairs using name for the key and value for the value. (Optional)
  • wait: Wait for the release to be installed before returning (Optional); default is false.

bekind's People

Contributors

christianh814 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

usrbinkat

bekind's Issues

[RFE] Profiles

Add support for profiles. This will be preset bekind config files that a user can call in order to quickly start instances without providing a config file.

  • Profile name will be based on a directory: ~/.bekind/profiles/{{name}}
  • When called, it'll run the config file found in the profile: ~/.bekind/profiles/{{name}}/config.yaml
  • The name of the KIND cluster is the name of the profile unless otherwise specified
  • Tab completion should work

Questions:

  • Should it be a subcommand of the start subcommand? Like bekind start --profile foo?
  • Should it be it's own subcommand bekind run foo or bekind profile foo?

OCI Registries

Add the ability to install Charts that are in an OCI registry

  - url: "oci://ghcr.io/akuity/kargo-charts/kargo"
    repo: "argo" # Ignored
    chart: "argo-cd" # Ignored
    release: "kargo"
    namespace: "kargo" 
    args: 'controller.logLevel=DEBUG'

Add the abilty to specify chart version

Just like helm install --version , bekind config should allow users to specify version of the chart

 - url: "https://argoproj.github.io/argo-helm"
    repo: "argo"
    chart: "argo-cd"
    release: "argocd"
    namespace: "argocd"
    version: 5.46.8 # ADD THIS
    args: 'server.ingress.enabled=true,server.ingress.hosts[0]=argocd.7f000001.nip.io,server.ingress.ingressClassName="nginx",server.ingress.https=true,server.ingress.annotations."nginx\.ingress\.kubernetes\.io/ssl-passthrough"=true,server.ingress.annotations."nginx\.ingress\.kubernetes\.io/force-ssl-redirect"=true'

The "lack" of version will mean just install the latest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.