Skip to content

Instantly share code, notes, and snippets.

@sniederm
Created December 4, 2022 17:37
Show Gist options
  • Save sniederm/f2674cb6b383c38d77914d0029481a26 to your computer and use it in GitHub Desktop.
Save sniederm/f2674cb6b383c38d77914d0029481a26 to your computer and use it in GitHub Desktop.
Create new KinD cluster with NGINX Ingress and Dashboard
echo "Creating Cluster..."
cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
EOF
echo "Installing Ingress..."
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
echo "Installing Dashboard..."
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
kubectl create serviceaccount -n kubernetes-dashboard admin-user
kubectl create clusterrolebinding -n kubernetes-dashboard admin-user --clusterrole cluster-admin --serviceaccount=kubernetes-dashboard:admin-user
token=$(kubectl -n kubernetes-dashboard create token admin-user)
echo "Dashboard token: ${token}"
echo "Dashboard url: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/"
kubectl proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment