본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

k3s agent

원문 보기 위키 갱신

이 섹션에서는 K3s 에이전트를 구성하는 방법을 배워요.

출처: 문서

본문

이 섹션에서는 K3s 에이전트를 구성하는 방법을 배워요.

서버도 에이전트를 실행한다는 점에 유의하세요. 그래서 이 페이지에 나열된 모든 플래그는 서버에서도 사용할 수 있어요.

이 페이지의 옵션은 CLI 플래그로 설명되지만, 설정 파일 옵션으로도 전달할 수 있어요. YAML 설정 파일 사용법에 대한 자세한 내용은 Configuration File 문서를 참고하세요.

로깅 (Logging)

| | Flag | Default | Description | -v value | 0 | Number for the log level verbosity | --vmodule value | N/A | Comma-separated list of FILE_PATTERN=LOG_LEVEL settings for file-filtered logging | --log value, -l value | N/A | Log to file | --alsologtostderr | N/A | Log to standard error as well as file (if set)

클러스터 옵션 (Cluster Options)

| | Flag | Environment Variable | Description | --token value, -t value | K3S_TOKEN | Token to use for authentication | --token-file value | K3S_TOKEN_FILE | Token file to use for authentication | --server value, -s value | K3S_URL | Server to connect to

리스너 (Listener)

| | Flag | Default | Description | --bind-address | 0.0.0.0 | k3s bind address

데이터 (Data)

| | Flag | Default | Description | --data-dir value, -d value | "/var/lib/rancher/k3s" | Folder to hold state

노드 (Node)

| | Flag | Environment Variable | Description | --node-name value | K3S_NODE_NAME | Node name | --with-node-id | N/A | Append id to node name | --node-label value | N/A | Registering and starting kubelet with set of labels | --node-taint value | N/A | Registering kubelet with set of taints | --protect-kernel-defaults | N/A | Kernel tuning behavior. If set, error if kernel tunables are different from kubelet defaults. | --selinux | K3S_SELINUX | Enable SELinux in containerd | --lb-server-port value | K3S_LB_SERVER_PORT | Local port for supervisor client load-balancer. If the supervisor and apiserver are not colocated an additional port 1 less than this port will also be used for the apiserver client load-balancer. (default: 6444)

런타임 (Runtime)

| | Flag | Default | Description | --container-runtime-endpoint | N/A | Disable embedded containerd and use the CRI socket at the given path; when used with --docker this sets the docker socket path | --default-runtime | N/A | Set the default runtime in containerd | --image-service-endpoint | N/A | Disable embedded containerd image service and use remote image service socket at the given path. If not specified, defaults to --container-runtime-endpoint. | --pause-image value | "docker.io/rancher/pause:3.1" | Customized pause image for containerd or docker sandbox | --private-registry value | "/etc/rancher/k3s/registries.yaml" | Private registry configuration file

네트워킹 (Networking)

| | Flag | Environment Variable | Description | --node-ip value, -i value | N/A | IP address to advertise for node | --node-external-ip value | N/A | External IP address to advertise for node | --node-internal-dns | N/A | internal DNS addresses to advertise for node | --node-external-dns | N/A | external DNS addresses to advertise for node | --resolv-conf value | K3S_RESOLV_CONF | Kubelet resolv.conf file | --flannel-iface value | N/A | Override default flannel interface | --flannel-conf value | N/A | Override default flannel config file | --flannel-cni-conf value | N/A | Override default flannel cni config file

커스터마이즈 플래그 (Customized Flags)

| | Flag | Description | --kubelet-arg value | Customized flag for kubelet process | --kube-proxy-arg value | Customized flag for kube-proxy process

실험적 (Experimental)

| | Flag | Description | --rootless | Run rootless | --docker | Use cri-dockerd instead of containerd | --enable-pprof | Enable pprof endpoint on supervisor port | --prefer-bundled-bin | Prefer bundled userspace binaries over host binaries | --disable-default-registry-endpoint | See "Default Endpoint Fallback" | --vpn-auth | See "Integration with the Tailscale VPN provider" | --vpn-auth-file | See "Integration with the Tailscale VPN provider"

폐기됨 (Deprecated)

| | Flag | Environment Variable | Description | --no-flannel | N/A | Use --flannel-backend=none | --cluster-secret value | K3S_CLUSTER_SECRET | Use --token

에이전트의 노드 라벨과 테인트 (Node Labels and Taints for Agents)

K3s 에이전트는 kubelet에 라벨과 테인트를 추가하는 --node-label 과 --node-taint 옵션으로 구성할 수 있어요. 두 옵션은 등록 시점에만 라벨·테인트를 추가하므로, 한 번만 추가할 수 있고 그 뒤로는 K3s 명령으로 다시 바꿀 수 없어요.

라벨과 테인트를 추가하는 예시는 아래와 같아요:

--node-label foo=bar \     --node-label hello=world \     --node-taint key1=value1:NoExecute

노드 등록 후 라벨과 테인트를 바꾸려면 kubectl 을 사용해야 해요. 테인트와 노드 라벨 추가 방법은 Kubernetes 공식 문서를 참고하세요.

K3s 에이전트 CLI 도움말

아래 괄호 안에 옵션이 나오면(예: [$K3S_URL]) 그 이름의 환경 변수로 옵션을 전달할 수 있다는 뜻이에요.

NAME:   k3s agent - Run node agentUSAGE:   k3s agent [OPTIONS]OPTIONS:   --config FILE, -c FILE                     (config) Load configuration from FILE (default: "/etc/rancher/k3s/config.yaml") [$K3S_CONFIG_FILE]   --debug                                    (logging) Turn on debug logs [$K3S_DEBUG]   -v value                                   (logging) Number for the log level verbosity (default: 0)   --vmodule value                            (logging) Comma-separated list of FILE_PATTERN=LOG_LEVEL settings for file-filtered logging   --log value, -l value                      (logging) Log to file   --alsologtostderr                          (logging) Log to standard error as well as file (if set)   --token value, -t value                    (cluster) Token to use for authentication [$K3S_TOKEN]   --token-file value                         (cluster) Token file to use for authentication [$K3S_TOKEN_FILE]   --server value, -s value                   (cluster) Server to connect to [$K3S_URL]   --data-dir value, -d value                 (agent/data) Folder to hold state (default: "/var/lib/rancher/k3s") [$K3S_DATA_DIR]   --node-name value                          (agent/node) Node name [$K3S_NODE_NAME]   --with-node-id                             (agent/node) Append id to node name   --node-label value                         (agent/node) Registering and starting kubelet with set of labels   --node-taint value                         (agent/node) Registering kubelet with set of taints   --image-credential-provider-bin-dir value  (agent/node) The path to the directory where credential provider plugin binaries are located (default: "/var/lib/rancher/credentialprovider/bin")   --image-credential-provider-config value   (agent/node) The path to the credential provider plugin config file (default: "/var/lib/rancher/credentialprovider/config.yaml")   --selinux                                  (agent/node) Enable SELinux in containerd [$K3S_SELINUX]   --lb-server-port value                     (agent/node) Local port for supervisor client load-balancer. If the supervisor and apiserver are not colocated an additional port 1 less than this port will also be used for the apiserver client load-balancer. (default: 6444) [$K3S_LB_SERVER_PORT]   --protect-kernel-defaults                  (agent/node) Kernel tuning behavior. If set, error if kernel tunables are different than kubelet defaults.   --container-runtime-endpoint value         (agent/runtime) Disable embedded containerd and use the CRI socket at the given path; when used with --docker this sets the docker socket path   --default-runtime value                    (agent/runtime) Set the default runtime in containerd   --image-service-endpoint value             (agent/runtime) Disable embedded containerd image service and use remote image service socket at the given path. If not specified, defaults to --container-runtime-endpoint.   --pause-image value                        (agent/runtime) Customized pause image for containerd or docker sandbox (default: "rancher/mirrored-pause:3.6")   --snapshotter value                        (agent/runtime) Override default containerd snapshotter (default: "overlayfs")   --private-registry value                   (agent/runtime) Private registry configuration file (default: "/etc/rancher/k3s/registries.yaml")   --disable-default-registry-endpoint        (agent/containerd) Disables containerd fallback default registry endpoint when a mirror is configured for that registry   --nonroot-devices                          (agent/containerd) Allows non-root pods to access devices by setting device_ownership_from_security_context=true in the containerd CRI config   --node-ip value, -i value                  (agent/networking) IPv4/IPv6 addresses to advertise for node   --bind-address value                       (listener) k3s bind address (default: 0.0.0.0)   --node-external-ip value                   (agent/networking) IPv4/IPv6 external IP addresses to advertise for node   --node-internal-dns value                  (agent/networking) internal DNS addresses to advertise for node   --node-external-dns value                  (agent/networking) external DNS addresses to advertise for node   --resolv-conf value                        (agent/networking) Kubelet resolv.conf file [$K3S_RESOLV_CONF]   --flannel-iface value                      (agent/networking) Override default flannel interface   --flannel-conf value                       (agent/networking) Override default flannel config file   --flannel-cni-conf value                   (agent/networking) Override default flannel cni config file   --kubelet-arg value                        (agent/flags) Customized flag for kubelet process   --kube-proxy-arg value                     (agent/flags) Customized flag for kube-proxy process   --enable-pprof                             (experimental) Enable pprof endpoint on supervisor port   --rootless                                 (experimental) Run rootless   --prefer-bundled-bin                       (experimental) Prefer bundled userspace binaries over host binaries   --docker                                   (agent/runtime) (experimental) Use cri-dockerd instead of containerd   --vpn-auth value                           (agent/networking) (experimental) Credentials for the VPN provider. It must include the provider name and join key in the format name=<vpn-provider>,joinKey=<key>[,controlServerURL=<url>][,extraArgs=<args>] [$K3S_VPN_AUTH]   --vpn-auth-file value                      (agent/networking) (experimental) File containing credentials for the VPN provider. It must include the provider name and join key in the format name=<vpn-provider>,joinKey=<key>[,controlServerURL=<url>][,extraArgs=<args>] [$K3S_VPN_AUTH_FILE]   --disable-apiserver-lb                     (agent/networking) (experimental) Disable the agent client-side load-balancer and connect directly to the configured server address

더 알아보기 (Learn more)