📜  k3s config (1)

📅  最后修改于: 2023-12-03 15:02:28.709000             🧑  作者: Mango

K3s Config

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.

Prerequisites

Before we get started, make sure you have the following prerequisites:

  • A running K3s cluster
  • kubectl installed and configured to connect to your K3s cluster
Configuring K3s

K3s 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 network
  • service-cidr - The CIDR block for the service network
  • node-taint - Taints to apply to the node
  • node-label - Labels to apply to the node
  • tls-san - The subject alternate name (SAN) for the TLS certificate
Applying the Configuration

Once 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
Conclusion

Configuring K3s is a fairly simple process. With a little bit of YAML editing, you can adjust the K3s configuration to suit your needs.