공부하기싫어

목차

     

    YAML

    # multi-node-cluster-config.yaml
    
    # a cluster with 3 control-plane nodes and 3 workers
    kind: Cluster
    apiVersion: kind.x-k8s.io/v1alpha4
    nodes:
    - role: control-plane
    - role: control-plane
    - role: control-plane
    - role: worker
    - role: worker
    - role: worker

    클러스터 생성

    PS C:\sungyeonwoo\SRE-Incubation\kind> .\kind create cluster --name yw-kind-cluster --config multi-node-cluster-config.yaml   
    Creating cluster "yw-kind-cluster" ...
     • Ensuring node image (kindest/node:v1.26.3) 🖼  ...
     ✓ Ensuring node image (kindest/node:v1.26.3) 🖼
     • Preparing nodes 📦 📦 📦 📦 📦 📦   ...
     ✓ Preparing nodes 📦 📦 📦 📦 📦 📦 
     • Configuring the external load balancer ⚖️  ...
     ✓ Configuring the external load balancer ⚖️
     • Writing configuration 📜  ...
     ✓ Writing configuration 📜
     • Starting control-plane 🕹️  ...
     ✓ Starting control-plane 🕹️
     • Installing CNI 🔌  ...
     ✓ Installing CNI 🔌
     • Installing StorageClass 💾  ...
     ✓ Installing StorageClass 💾
     • Joining more control-plane nodes 🎮  ...
     ✓ Joining more control-plane nodes 🎮
     • Joining worker nodes 🚜  ...
     ✓ Joining worker nodes 🚜
    Set kubectl context to "kind-yw-kind-cluster"
    You can now use your cluster with:
    
    kubectl cluster-info --context kind-yw-kind-cluster
    
    Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community 🙂

    생성 확인

    클러스터 정보

    PS C:\sungyeonwoo\SRE-Incubation\kind> kubectl cluster-info --context kind-yw-kind-cluster
    Kubernetes control plane is running at https://127.0.0.1:55292
    CoreDNS is running at https://127.0.0.1:55292/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
    
    To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

     

    docker ps

    PS C:\sungyeonwoo\SRE-Incubation\kind> docker ps   
    CONTAINER ID   IMAGE                                COMMAND                  CREATED         STATUS         PORTS                       NAMES
    43e579737553   kindest/haproxy:v20230227-d46f45b6   "haproxy -sf 7 -W -d…"   2 minutes ago   Up 2 minutes   127.0.0.1:55292->6443/tcp   yw-kind-cluster-external-load-balancer
    7f10681b2dee   kindest/node:v1.26.3                 "/usr/local/bin/entr…"   2 minutes ago   Up 2 minutes                               yw-kind-cluster-worker3
    ab17bc4f9129   kindest/node:v1.26.3                 "/usr/local/bin/entr…"   2 minutes ago   Up 2 minutes                               yw-kind-cluster-worker
    315b7325874b   kindest/node:v1.26.3                 "/usr/local/bin/entr…"   2 minutes ago   Up 2 minutes   127.0.0.1:55293->6443/tcp   yw-kind-cluster-control-plane
    14c72bc18cec   kindest/node:v1.26.3                 "/usr/local/bin/entr…"   2 minutes ago   Up 2 minutes                               yw-kind-cluster-worker2
    4be4ac19f5f0   kindest/node:v1.26.3                 "/usr/local/bin/entr…"   2 minutes ago   Up 2 minutes   127.0.0.1:55290->6443/tcp   yw-kind-cluster-control-plane2
    ae1f33516147   kindest/node:v1.26.3                 "/usr/local/bin/entr…"   2 minutes ago   Up 2 minutes   127.0.0.1:55291->6443/tcp   yw-kind-cluster-control-plane3

     

    kubectl get nodes

    PS C:\sungyeonwoo\SRE-Incubation\kind> kubectl get nodes
    NAME                             STATUS   ROLES           AGE     VERSION
    yw-kind-cluster-control-plane    Ready    control-plane   2m40s   v1.26.3
    yw-kind-cluster-control-plane2   Ready    control-plane   2m8s    v1.26.3
    yw-kind-cluster-control-plane3   Ready    control-plane   103s    v1.26.3
    yw-kind-cluster-worker           Ready    <none>          83s     v1.26.3
    yw-kind-cluster-worker2          Ready    <none>          83s     v1.26.3
    yw-kind-cluster-worker3          Ready    <none>          83s     v1.26.3

     

    kubectl get all -A

    PS C:\sungyeonwoo\SRE-Incubation\kind> kubectl get all -A
    NAMESPACE            NAME                                                         READY   STATUS    RESTARTS   AGE
    kube-system          pod/coredns-787d4945fb-6gq5c                                 1/1     Running   0          2m39s
    kube-system          pod/coredns-787d4945fb-cf7r2                                 1/1     Running   0          2m39s
    kube-system          pod/etcd-yw-kind-cluster-control-plane                       1/1     Running   0          2m50s
    kube-system          pod/etcd-yw-kind-cluster-control-plane2                      1/1     Running   0          2m10s
    kube-system          pod/etcd-yw-kind-cluster-control-plane3                      1/1     Running   0          113s
    kube-system          pod/kindnet-9jlv4                                            1/1     Running   0          95s
    kube-system          pod/kindnet-dwd8w                                            1/1     Running   0          2m37s
    kube-system          pod/kindnet-hbw4t                                            1/1     Running   0          95s
    kube-system          pod/kindnet-nnqj5                                            1/1     Running   0          95s
    kube-system          pod/kindnet-pwb6c                                            1/1     Running   0          115s
    kube-system          pod/kindnet-vdgcl                                            1/1     Running   0          2m20s
    kube-system          pod/kube-apiserver-yw-kind-cluster-control-plane             1/1     Running   0          2m51s
    kube-system          pod/kube-apiserver-yw-kind-cluster-control-plane2            1/1     Running   0          2m1s
    kube-system          pod/kube-apiserver-yw-kind-cluster-control-plane3            1/1     Running   0          100s
    kube-system          pod/kube-controller-manager-yw-kind-cluster-control-plane    1/1     Running   0          2m50s
    kube-system          pod/kube-controller-manager-yw-kind-cluster-control-plane2   1/1     Running   0          70s
    kube-system          pod/kube-controller-manager-yw-kind-cluster-control-plane3   1/1     Running   0          110s
    kube-system          pod/kube-proxy-9g2kj                                         1/1     Running   0          95s
    kube-system          pod/kube-proxy-cvpgs                                         1/1     Running   0          2m20s
    kube-system          pod/kube-proxy-djxm8                                         1/1     Running   0          2m40s
    kube-system          pod/kube-proxy-fzzlv                                         1/1     Running   0          95s
    kube-system          pod/kube-proxy-s6trh                                         1/1     Running   0          115s
    kube-system          pod/kube-proxy-v5sh2                                         1/1     Running   0          95s
    kube-system          pod/kube-scheduler-yw-kind-cluster-control-plane             1/1     Running   0          2m50s
    kube-system          pod/kube-scheduler-yw-kind-cluster-control-plane2            1/1     Running   0          2m9s
    kube-system          pod/kube-scheduler-yw-kind-cluster-control-plane3            1/1     Running   0          107s
    local-path-storage   pod/local-path-provisioner-75f5b54ffd-l6kxf                  1/1     Running   0 
             2m36s
    
    NAMESPACE     NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
    default       service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP                  2m57s
    kube-system   service/kube-dns     ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP,9153/TCP   2m51s
    
    NAMESPACE     NAME                        DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
    kube-system   daemonset.apps/kindnet      6         6         6       6            6           kubernetes.io/os=linux   2m37s
    kube-system   daemonset.apps/kube-proxy   6         6         6       6            6           kubernetes.io/os=linux   2m51s
    
    NAMESPACE            NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE    
    kube-system          deployment.apps/coredns                  2/2     2            2           2m51s  
    local-path-storage   deployment.apps/local-path-provisioner   1/1     1            1           2m36s  
    
    NAMESPACE            NAME                                                DESIRED   CURRENT   READY   AGE
    kube-system          replicaset.apps/coredns-787d4945fb                  2         2         2       2m40s
    local-path-storage   replicaset.apps/local-path-provisioner-75f5b54ffd   1         1         1       2m36s

     

     

    kube-bench Scan

    PS C:\sungyeonwoo\SRE-Incubation\kube-bench> kubectl apply -f kubebench.yaml
    job.batch/kube-bench created
    PS C:\sungyeonwoo\SRE-Incubation\kube-bench> kubectl get pods 
    NAME               READY   STATUS              RESTARTS   AGE
    kube-bench-8t754   0/1     ContainerCreating   0          7s
    PS C:\sungyeonwoo\SRE-Incubation\kube-bench> kubectl logs kube-bench-8t754 > output.log

    참고

    https://jupilhwang.github.io/post/kind%EB%A5%BC-%EC%9D%B4%EC%9A%A9%ED%95%9C-%EC%BF%A0%EB%B2%84%EB%84%A4%ED%8B%B0%EC%8A%A4-%ED%81%B4%EB%9F%AC%EC%8A%A4%ED%84%B0-%EB%A7%8C%EB%93%A4%EA%B8%B0/

     

    Kind를 이용한 쿠버네티스 클러스터 만들기

     

    jupilhwang.github.io

    https://kind.sigs.k8s.io/docs/user/quick-start/#installation

     

    kind – Quick Start

    Quick Start This guide covers getting started with the kind command. If you are having problems please see the known issues guide. NOTE: kind does not require kubectl, but you will not be able to perform some of the examples in our docs without it. To inst

    kind.sigs.k8s.io

     

    'Kubernetes > vanilla k8s' 카테고리의 다른 글

    kubeadm  (0) 2023.06.02
    [kind] kind 설치 - Single Node (Window)  (0) 2023.05.21