📅  最后修改于: 2023-12-03 15:02:28.709000             🧑  作者: Mango
K3s is a lightweight and easy-to-install Kubernetes distribution designed for developers and edge computing. In this guide, we will explore how to configure K3s for your needs.
Before we get started, make sure you have the following prerequisites:
kubectl
installed and configured to connect to your K3s clusterK3s comes with a default configuration that should work fine for most use cases. However, you may want to adjust the configuration to suit your needs. K3s uses a YAML file to store its configuration. You can find the default configuration file at /etc/rancher/k3s/config.yaml
on your K3s server.
You can modify this file to adjust the configuration. Some of the common configuration options that you might want to modify include:
cluster-cidr
- The CIDR block for the pod networkservice-cidr
- The CIDR block for the service networknode-taint
- Taints to apply to the nodenode-label
- Labels to apply to the nodetls-san
- The subject alternate name (SAN) for the TLS certificateOnce you have made the necessary modifications to the configuration file, you need to apply the changes to your K3s cluster. You can do this by restarting the K3s server process.
sudo systemctl stop k3s
sudo systemctl start k3s
Alternatively, you can use kubectl
to apply the changes to the server configuration directly.
kubectl apply -f /etc/rancher/k3s/config.yaml
Configuring K3s is a fairly simple process. With a little bit of YAML editing, you can adjust the K3s configuration to suit your needs.