Skip to content

Instantly share code, notes, and snippets.

@vitaly-z
Forked from icebob/docker-compose.yml
Created November 1, 2023 06:02
Show Gist options
  • Select an option

  • Save vitaly-z/7340c6fc0a2e12280e3dac0048c16334 to your computer and use it in GitHub Desktop.

Select an option

Save vitaly-z/7340c6fc0a2e12280e3dac0048c16334 to your computer and use it in GitHub Desktop.
Start K3S Cluster on Docker
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