Merge pull request #3441 from dereknola/k3s_skip

K3s: Added skip file documentation, fixed typo
This commit is contained in:
Catherine Luse
2021-08-13 12:06:35 -07:00
committed by GitHub
2 changed files with 24 additions and 9 deletions
@@ -3,16 +3,16 @@ title: "Disable Components Flags"
weight: 60
---
When starting K3s server with --cluster-init it will run all control plane components that includes (api server, controller manager, scheduler, and etcd). However you can run server nodes with certain components and execlude others, the following sectiohs will explain how to do that.
When starting K3s server with --cluster-init it will run all control plane components that includes (api server, controller manager, scheduler, and etcd). However you can run server nodes with certain components and execlude others, the following sections will explain how to do that.
# ETCD Only Nodes
This document assumes you run K3s server with embedded etcd by passing `--cluster-init` flag to the server process.
To run a K3s server with only etcd components you can pass `--disable-api-server --disable-controller-manager --disable-scheduler` flags to k3s, this will result in running a server node with only etcd, for example to run K3s server with those flags:
To run a K3s server with only etcd components you can pass `--disable-apiserver --disable-controller-manager --disable-scheduler` flags to k3s, this will result in running a server node with only etcd, for example to run K3s server with those flags:
```
curl -fL https://get.k3s.io | sh -s - server --cluster-init --disable-api-server --disable-controller-manager --disable-scheduler
curl -fL https://get.k3s.io | sh -s - server --cluster-init --disable-apiserver --disable-controller-manager --disable-scheduler
```
You can join other nodes to the cluster normally after that.
@@ -34,12 +34,12 @@ ip-172-31-13-32 Ready etcd 5h39m v1.20.4+k3s1
ip-172-31-14-69 Ready control-plane,master 5h39m v1.20.4+k3s1
```
Note that you can run `kubectl` commands only on the k3s server that has the api running, and you cant run `kubectl` commands on etcd only nodes.
Note that you can run `kubectl` commands only on the k3s server that has the api running, and you can't run `kubectl` commands on etcd only nodes.
### Re-enabling control components
In both cases you can re-enable any component that you already disabled simply by removing the corresponding flag that disables them, so for example if you want to revert the etcd only node back to a full k3s server with all components you can just remove the following 3 flags `--disable-api-server --disable-controller-manager --disable-scheduler`, so in our example to revert back node `ip-172-31-13-32` to a full k3s server you can just re-run the curl command without the disable flags:
In both cases you can re-enable any component that you already disabled simply by removing the corresponding flag that disables them, so for example if you want to revert the etcd only node back to a full k3s server with all components you can just remove the following 3 flags `--disable-apiserver --disable-controller-manager --disable-scheduler`, so in our example to revert back node `ip-172-31-13-32` to a full k3s server you can just re-run the curl command without the disable flags:
```
curl -fL https://get.k3s.io | sh -s - server --cluster-init
```
@@ -57,11 +57,11 @@ Notice that role labels has been re-added to the node `ip-172-31-13-32` with the
# Add disable flags using the config file
In any of the previous situation you can use the config file instead of running the curl commands with the associated flags, for example to run an etcd only node you can add the following options to the `/etc/rancher/k3s/config.yaml` file:
In any of the previous situations you can use the config file instead of running the curl commands with the associated flags, for example to run an etcd only node you can add the following options to the `/etc/rancher/k3s/config.yaml` file:
```
---
disable-api-server: true
disable-apiserver: true
disable-controller-manager: true
disable-scheduler: true
cluster-init: true
@@ -70,4 +70,19 @@ and then start K3s using the curl command without any arguents:
```
curl -fL https://get.k3s.io | sh -
```
```
# Disable components using .skip files
For any yaml file under `/var/lib/rancher/k3s/server/manifests` (coredns, traefik, local-storeage, etc.) you can add a `.skip` file which will cause K3s to not apply the associated yaml file.
For example, adding `traefik.yaml.skip` in the manifests directory will cause K3s to skip `traefik.yaml`.
```
ls /var/lib/rancher/k3s/server/manifests
ccm.yaml local-storage.yaml rolebindings.yaml traefik.yaml.skip
coredns.yaml traefik.yaml
kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system local-path-provisioner-64ffb68fd-xx98j 1/1 Running 0 74s
kube-system metrics-server-5489f84d5d-7zwkt 1/1 Running 0 74s
kube-system coredns-85cb69466-vcq7j 1/1 Running 0 74s
```
@@ -46,7 +46,7 @@ When using this method to install K3s, the following environment variables can b
| `INSTALL_K3S_CHANNEL_URL` | Channel URL for fetching K3s download URL. Defaults to https://update.k3s.io/v1-release/channels. |
| `INSTALL_K3S_CHANNEL` | Channel to use for fetching K3s download URL. Defaults to "stable". Options include: `stable`, `latest`, `testing`. |
This example shows where to place aformentioned environment variables as options (after the pipe):
This example shows where to place aforementioned environment variables as options (after the pipe):
```
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=latest sh -