هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
The quick answer
Step by step
- A multi-node cluster with a port to the host — a config file:
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30080
hostPort: 8080
- role: worker
- role: workerkind create cluster --name lab --config kind-lab.yaml
kubectl get nodes
NAME STATUS ROLES AGE VERSION
lab-control-plane Ready control-plane 45s v1.33.1
lab-worker Ready <none> 25s v1.33.1
lab-worker2 Ready <none> 25s v1.33.1- A specific Kubernetes version (to test an upgrade or match production):
--image kindest/node:vX.Y.Z(use an image listed in the kind release notes). - Use local images without a registry:
In the Pod spec use image: shop/api:dev with imagePullPolicy: IfNotPresent.
- Reach an app — a NodePort on 30080 is mapped to
localhost:8080(config above), or simply port-forward:
kubectl port-forward svc/api 8000:80- NetworkPolicies? kind's default CNI (kindnet) supports basic NetworkPolicies in newer versions; to test Calico/Cilium features, create the cluster with
disableDefaultCNI: trueand install that CNI. - In CI — create a cluster per job, run tests, delete it (GitHub Actions has a ready
helm/kind-action). - Clean up:
Check that it worked
kubectl get nodes shows all nodes Ready, a test Deployment starts, and kind delete cluster removes everything (no leftover containers in docker ps).
Common problems
| Problem | Cause | Fix |
|---|---|---|
Cannot connect to the Docker daemon | Docker not running / no rights. | Start Docker; your user in the docker group (or use rootless Podman with KIND_EXPERIMENTAL_PROVIDER=podman). |
ErrImagePull for a local image | Image not loaded into kind, or imagePullPolicy: Always. | kind load docker-image; IfNotPresent. |
| Too many open files / nodes not Ready | inotify limits on the host. | Raise fs.inotify.max_user_watches and max_user_instances. |
| Port on localhost does not answer | No extraPortMappings, or the Service is not on that NodePort. | Map the port at create time; or use port-forward. |
| kubectl talks to the wrong cluster | Context changed to kind-lab. | kubectl config use-context NAME. |
| Cluster gone after a reboot | Containers did not restart. | Recreate it — kind clusters are throw-away. |
Go further
- Command pages: kind, kubectl, docker, minikube.
- Next how-tos: Install an app with Helm, Write a Kubernetes NetworkPolicy, Switch between clusters and namespaces.
- Full guide: minikube and kind. Learn it: Local clusters in DevOps.
1How do you use an image you built locally in a kind cluster?
kind load docker-image IMAGE --name CLUSTER and imagePullPolicy: IfNotPresent.
2Why is kind popular in CI pipelines?
A real cluster starts in about a minute and is deleted after the test — every job gets a clean cluster.