You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced/advanced.md
+20-30Lines changed: 20 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -365,47 +365,37 @@ There are several ways to run K3s in Docker:
365
365
<Tabs>
366
366
<TabItem value='K3d' default>
367
367
368
-
[k3d](https://github.com/k3d-io/k3d) is a utility designed to easily run K3s in Docker.
368
+
[k3d](https://github.com/k3d-io/k3d) is a utility designed to easily run multi-node K3s clusters in Docker.
369
369
370
-
It can be installed via the [brew](https://brew.sh/) utility on MacOS:
370
+
k3d makes it very easy to create single- and multi-node k3s clusters in docker, e.g. for local development on Kubernetes.
371
371
372
-
```bash
373
-
brew install k3d
374
-
```
375
-
376
-
</TabItem>
377
-
<TabItem value="Docker Compose">
378
-
379
-
A `docker-compose.yml` in the K3s repo serves as an [example](https://github.com/k3s-io/k3s/blob/master/docker-compose.yml) of how to run K3s from Docker. To run `docker-compose` in this repo, run:
380
-
381
-
```bash
382
-
docker-compose up --scale agent=3
383
-
# kubeconfig is written to current dir
384
-
385
-
kubectl --kubeconfig kubeconfig.yaml get node
386
-
387
-
NAME STATUS ROLES AGE VERSION
388
-
497278a2d6a2 Ready <none> 11s v1.13.2-k3s2
389
-
d54c8b17c055 Ready <none> 11s v1.13.2-k3s2
390
-
db7a5a5a5bdd Ready <none> 12s v1.13.2-k3s2
391
-
```
392
-
393
-
To only run the agent in Docker, use `docker-compose up agent`.
372
+
See the [Installation](https://k3d.io/#installation) documentation for more information on how to install and use k3d.
394
373
395
374
</TabItem>
396
375
<TabItem value="Docker">
397
376
398
-
To use Docker, `rancher/k3s` images are also available to run the K3s server and agent.
377
+
To use Docker, `rancher/k3s` images are also available to run the K3s server and agent.
399
378
Using the `docker run` command:
400
379
401
380
```bash
402
381
sudo docker run \
403
-
-d --tmpfs /run \
404
-
--tmpfs /var/run \
405
-
-e K3S_URL=${SERVER_URL} \
406
-
-e K3S_TOKEN=${NODE_TOKEN} \
407
-
--privileged rancher/k3s:vX.Y.Z
382
+
--privileged \
383
+
--name k3s-server-1 \
384
+
--hostname k3s-server-1 \
385
+
-p 6443:6443 \
386
+
-d rancher/k3s:v1.24.10-k3s1 \
387
+
server
388
+
```
389
+
:::note
390
+
You must specify a valid K3s version as the tag; the `latest` tag is not maintained.
391
+
Docker images do not allow a `+` sign in tags, use a `-` in the tag instead.
392
+
:::
393
+
394
+
Once K3s is up and running, you can copy the admin kubeconfig out of the Docker container for use:
0 commit comments