Start k3s with docker-compose

Get source

git clone [email protected]:rancher/k3s.git

to start

cd k3s
K3S_TOKEN=${RANDOM}${RANDOM}${RANDOM} docker-compose up -d

Make kubectl refer to the settings

export KUBECONFIG=./kubeconfig.yaml

Try to get nodes

kubectl get nodes

output

NAME           STATUS   ROLES    AGE   VERSION
65e2440e6916   Ready    <none>   11m   v1.19.4+k3s1
774f7268c91f   Ready    master   11m   v1.19.4+k3s1

Install dashboard

GITHUB_URL=https://github.com/kubernetes/dashboard/releases
VERSION_KUBE_DASHBOARD=$(curl -w '%{url_effective}' -I -L -s -S ${GITHUB_URL}/latest -o /dev/null | sed -e 's|.*/||')
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml
 echo 'apiVersion: v1                                                                                                                                                                    
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard' | kubectl apply -f -
echo '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' | kubectl apply -f -

Get token

kubectl -n kubernetes-dashboard describe secret admin-user-token | grep "^token"

Launch a proxy to access the dashboard

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

image.png

refs

Recommended Posts

Start k3s with docker-compose
Container does not start with docker-compose
Run batch with docker-compose with Java batch
Docker-compose deploying Neo4j with APOC
What I did when the DB did not start with docker-compose up
[SRE / Docker] Start control with Dockerize
Precautions when creating PostgreSQL with docker-compose
Create Laravel environment with Docker (docker-compose)
mysql doesn't start up with docker.
Java, arrays to start with beginners
[Linux] Start Apache container with Docker
How to start Camunda with Docker
Specify the favorite IP of the host network with docker-compose and start it
Start UI testing with Dagger2 and Mockito
docker-compose Rebuild and start Only one container
Build and manage RStudio environment with Docker-compose
Try running MySql and Blazor with docker-compose
Start web application development with Spring Boot
Launch Nginx + Spring Boot application with docker-compose
[Among Us] Launch automuteus v4.0.4 with docker-compose
Build Nuxt TypeScript + Vuetify environment with docker-compose
How to monitor nginx with docker-compose with datadog
Sample to start Ubuntu with Deployment with client-go
Until you start Zabbix Server with docker-compose and get information from other hosts