Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

kind

Kubernetes in Docker: start a real multi-node cluster in containers in seconds — for tests, CI and practice.

Niveau
DevSecOps-service
Groep
Containers en Kubernetes
Root nodig
Voor wijzigingen
Pakket
kind

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

kind runs each Kubernetes node as a container (with Docker or podman). It is used by the Kubernetes project itself for tests, and in CI pipelines to test Helm charts, manifests and operators. You can create, break and delete clusters quickly — perfect for CKA/CKS practice.

A config file sets the number of nodes, the Kubernetes version (node image) and port mappings.

Zo schrijf je het

kind create cluster [--name NAME] [--config FILE] [--image kindest/node:vX]
kind delete cluster [--name NAME]

Belangrijkste delen

Commands

create cluster
Make a cluster.
delete cluster / delete clusters --all
Remove clusters.
get clusters / get nodes
List clusters / nodes.
get kubeconfig
Print the kubeconfig.
load docker-image IMG
Copy a local image into the nodes.
load image-archive FILE.tar
Copy an image archive into the nodes.
export logs DIR
Save all node logs (for CI failures).

Opties 5

Meest gebruikt

Flags

--name NAME
Cluster name (default kind).
--config FILE
Cluster config file.
--image kindest/node:v1.31.2
Kubernetes version.
--wait 2m
Wait for the control plane.
KIND_EXPERIMENTAL_PROVIDER=podman
Use podman instead of Docker.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Make a cluster and use it

    kind create cluster --name lab
    kubectl cluster-info --context kind-lab
    kubectl get nodes
  2. 2A 1 + 2 node cluster with a port for ingress

    cat kind-3.yaml
    kind: Cluster
    apiVersion: kind.x-k8s.io/v1alpha4
    nodes:
      - role: control-plane
        extraPortMappings:
          - { containerPort: 80, hostPort: 8080 }
      - role: worker
      - role: worker
    kind create cluster --name lab3 --config kind-3.yaml --image kindest/node:v1.31.2
  3. 3Test your own image without a registry

    docker build -t shop:dev .
    kind load docker-image shop:dev --name lab
    kubectl create deployment shop --image=shop:dev

    Use imagePullPolicy: IfNotPresent (or a tag other than latest).

  4. 4Use kind in GitHub Actions

    cat .github/workflows/k8s-test.yml
    jobs:
      test:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: helm/kind-action@v1
          - run: kubectl apply -k deploy/overlays/dev && kubectl rollout status deploy/shop
  5. 5Save logs when a test fails

    kind export logs ./kind-logs --name lab
  6. 6Use podman

    KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster
  7. 7List and delete

    kind get clusters
    kind delete cluster --name lab
  8. 8Run several clusters side by side

    kind create cluster --name blue && kind create cluster --name green
    kubectl config get-contexts | grep kind-
  9. 9Print the kubeconfig of a cluster

    kind get kubeconfig --name lab > lab.kubeconfig
    KUBECONFIG=lab.kubeconfig kubectl get nodes
  10. 10Install an ingress controller in kind

    kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml
    kubectl wait -n ingress-nginx --for=condition=ready pod -l app.kubernetes.io/component=controller --timeout=120s

Let op

  • kind clusters are for testing, not production.
  • Many nodes need much RAM; raise fs.inotify.max_user_instances if pods fail with "too many open files".

Bestanden

~/.kube/config
kind adds a context kind-NAME.

Tips om te onthouden

  • Pin the node image version to match the version of your real cluster.

Exitcodes

0Success.
1Error.

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man kind