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
createcluster- Make a cluster.
deletecluster/deleteclusters--all- Remove clusters.
getclusters/getnodes- List clusters / nodes.
getkubeconfig- Print the kubeconfig.
loaddocker-imageIMG- Copy a local image into the nodes.
loadimage-archiveFILE.tar- Copy an image archive into the nodes.
exportlogsDIR- Save all node logs (for CI failures).
Opties 5
Meest gebruikt
Flags
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1Make a cluster and use it
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.23Test 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:devUse
imagePullPolicy: IfNotPresent(or a tag other than latest).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/shop5Save logs when a test fails
kind export logs ./kind-logs --name lab6Use podman
KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster7List and delete
kind get clusters kind delete cluster --name lab8Run several clusters side by side
9Print the kubeconfig of a cluster
kind get kubeconfig --name lab > lab.kubeconfig KUBECONFIG=lab.kubeconfig kubectl get nodes10Install an ingress controller in kind
Niets past bij dit filter.
Let op
- kind clusters are for testing, not production.
- Many nodes need much RAM; raise
fs.inotify.max_user_instancesif 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
0 | Success. |
1 | Error. |