bekind

command module
v0.0.0-...-eda4e03 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

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.

Documentation

Overview

Copyright © 2022 Christian Hernandez christian@chernand.io

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL