Last active
November 1, 2023 06:02
-
-
Save icebob/9c7cc01fbc9fb6883b5c3398e26fb3d5 to your computer and use it in GitHub Desktop.
Start K3S Cluster on Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
server: | |
image: "rancher/k3s:latest" | |
command: server | |
tmpfs: | |
- /run | |
- /var/run | |
privileged: true | |
environment: | |
- K3S_TOKEN=token1234567890 | |
- K3S_NODE_NAME=master | |
- K3S_KUBECONFIG_OUTPUT=/output/kube.config | |
- K3S_KUBECONFIG_MODE=666 | |
volumes: | |
- k3s-server:/var/lib/rancher/k3s | |
- .:/output | |
ports: | |
- 6443:6443 | |
- 80:80 | |
- 443:443 | |
- 8080:8080 | |
restart: unless-stopped | |
worker1: | |
image: "rancher/k3s:latest" | |
tmpfs: | |
- /run | |
- /var/run | |
privileged: true | |
environment: | |
- K3S_URL=https://server:6443 | |
- K3S_TOKEN=token1234567890 | |
- K3S_NODE_NAME=worker-1 | |
volumes: | |
- k3s-worker1:/var/lib/rancher/k3s | |
restart: unless-stopped | |
worker2: | |
image: "rancher/k3s:latest" | |
tmpfs: | |
- /run | |
- /var/run | |
privileged: true | |
environment: | |
- K3S_URL=https://server:6443 | |
- K3S_TOKEN=token1234567890 | |
- K3S_NODE_NAME=worker-2 | |
volumes: | |
- k3s-worker2:/var/lib/rancher/k3s | |
restart: unless-stopped | |
volumes: | |
k3s-server: {} | |
k3s-worker1: {} | |
k3s-worker2: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With Longhorn: