K3D Fundamental

Run k8s locally with k3s

Prerequisites

  • kubernetes-cli (kubectl)
  • docker

Installation

Linux (Arch Based)

1
yay -S rancher-k3d-bin

Windows

1
choco install k3d

Mac

1
brew install k3d

Getting Started

Create Cluster

1
k3d cluster create your-cluster-name -s 1 -a 3 

Dashboard Installation

Option1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# enable port forwarding
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
# create cluster
k3d cluster create dashboard-cluster --api-port 6550 -p "8080:80@loadbalancer" --agents 2
# deploy dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
# create service account
kubectl create serviceaccount dashboard-admin
# Bind the service account to the cluster-admin role
kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=default:dashboard-admin
# Retrieve access token, copy the token
kubectl create token dashboard-admin
# Access the dashboard
kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 8443:443 --address 0.0.0.0

Then open the browser to access localhost:8443 and paste the token.

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus