الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

kind

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

المستوى
خدمة DevSecOps
المجموعة
الحاويات و Kubernetes
يحتاج root
للتغييرات
الحزمة
kind

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

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.

طريقة الكتابة

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

الأجزاء الرئيسية

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).

الخيارات 5

الأكثر استخدامًا

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.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع 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

انتبه

  • 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".

الملفات

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

نصائح للحفظ

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

رموز الخروج

0Success.
1Error.

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man kind