|
本文档采用自动化机器翻译技术翻译。 尽管我们力求提供准确的译文,但不对翻译内容的完整性、准确性或可靠性作出任何保证。 若出现任何内容不一致情况,请以原始 英文 版本为准,且原始英文版本为权威文本。 |
k3s 代理
在本节中,您将学习如何配置 K3s 代理。
请注意,服务器也运行代理,因此本页面列出的所有标志也适用于服务器。
选项在本页面上以 CLI 标志的形式记录,但也可以作为配置文件选项传递。有关使用 YAML 配置文件的更多信息,请参见 配置文件 文档。
日志记录
| 标志 | 默认值 | 说明 |
|---|---|---|
|
0 |
日志级别详细程度的数字 |
|
不适用 |
以逗号分隔的 FILE_PATTERN=LOG_LEVEL 设置的列表,用于文件过滤日志 |
|
不适用 |
记录到文件 |
|
不适用 |
同时记录到标准错误和文件(如果设置) |
群集选项
| 标志 | 环境变量 | 说明 |
|---|---|---|
|
|
用于身份验证的词元 |
|
|
用于身份验证的词元文件 |
|
|
要连接的服务器 |
节点
| 标志 | 环境变量 | 说明 |
|---|---|---|
|
|
节点名称 |
|
不适用 |
将 ID 附加到节点名称 |
|
不适用 |
使用标签集注册并启动 kubelet |
|
不适用 |
使用污点集注册kubelet |
|
不适用 |
内核调优行为。如果设置,内核可调参数与kubelet默认值不同则报错。 |
|
|
在containerd中启用SELinux |
|
|
用于主管客户端负载均衡器的本地端口。如果主管和apiserver不在同一位置,将使用比此端口少1的额外端口用于apiserver客户端负载均衡器。(默认:6444) |
运行时
| 标志 | 默认值 | 说明 |
|---|---|---|
|
不适用 |
禁用嵌入式containerd并使用给定路径的CRI套接字;与—docker一起使用时,这将设置docker套接字路径 |
|
不适用 |
在containerd中设置默认运行时 |
|
不适用 |
禁用嵌入式containerd镜像服务,并使用给定路径的远程镜像服务套接字。如果未指定,默认为—container-runtime-endpoint。 |
|
"docker.io/rancher/pause:3.1" |
用于containerd或docker沙盒的自定义暂停镜像 |
|
"/etc/rancher/k3s/registries.yaml" |
私有注册表配置文件 |
网络
| 标志 | 环境变量 | 说明 |
|---|---|---|
|
不适用 |
要为节点宣传的IP地址 |
|
不适用 |
要为节点宣传的外部IP地址 |
|
不适用 |
要为节点宣传的内部DNS地址 |
|
不适用 |
要为节点宣传的外部DNS地址 |
|
|
Kubelet resolv.conf 文件 |
|
不适用 |
覆盖默认的flannel接口 |
|
不适用 |
覆盖默认的flannel配置文件 |
|
不适用 |
覆盖默认的flannel cni配置文件 |
实验性
| 标志 | 说明 |
|---|---|
|
以无根模式运行 |
|
使用 cri-dockerd 而不是 containerd |
|
在主管端口启用 pprof 端点 |
|
优先使用捆绑的用户空间二进制文件而不是主机二进制文件 |
|
请参见 "默认端点回退" |
|
请参见 "与 Tailscale VPN 提供商的集成" |
|
请参见 "与 Tailscale VPN 提供商的集成" |
不推荐
| 标志 | 环境变量 | 说明 |
|---|---|---|
|
不适用 |
使用 |
|
|
使用 |
K3s 代理 CLI 帮助
如果选项在下面的括号中出现,例如
[$K3S_URL],则表示该选项可以作为该名称的环境变量传递。
NAME:
k3s agent - Run node agent
USAGE:
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