Skip to content

Latest commit

 

History

History
115 lines (87 loc) · 2.39 KB

File metadata and controls

115 lines (87 loc) · 2.39 KB

KIND Cluster Setup Guide

1. Installing KIND and kubectl

Install KIND and kubectl using the provided script:

2. Setting Up the KIND Cluster

Create a kind-config.yaml file:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
    image: kindest/node:v1.33.1
  - role: worker
    image: kindest/node:v1.33.1
  - role: worker
    image: kindest/node:v1.33.1

Create the cluster using the configuration file:

kind create cluster --config kind-config.yaml --name tws-kind-cluster

Verify the cluster:

kubectl get nodes
kubectl cluster-info

3. Accessing the Cluster

Use kubectl to interact with the cluster:

kubectl cluster-info

4. Setting Up the Kubernetes Dashboard

Deploy the Dashboard Apply the Kubernetes Dashboard manifest:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

Create an Admin User Create a dashboard-admin-user.yml file with the following content:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard

Apply the configuration:

kubectl apply -f dashboard-admin-user.yml

Get the Access Token Retrieve the token for the admin-user:

kubectl -n kubernetes-dashboard create token admin-user

Copy the token for use in the Dashboard login.

Access the Dashboard Start the Dashboard using kubectl proxy:

kubectl proxy

Open the Dashboard in your browser:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

Use the token from the previous step to log in.

5. Deleting the Cluster

Delete the KIND cluster:

kind delete cluster --name my-kind-cluster

6. Notes

Multiple Clusters: KIND supports multiple clusters. Use unique --name for each cluster. Custom Node Images: Specify Kubernetes versions by updating the image in the configuration file. Ephemeral Clusters: KIND clusters are temporary and will be lost if Docker is restarted.