Skip to main content

Server Configuration Reference

This is a reference to all parameters that can be used to configure the rke2 server. Note that while this is a reference to the command line arguments, the best way to configure RKE2 is using the configuration file.

Critical Configuration Values

The following options must be set to the same value on all servers in the cluster. Failure to do so will cause new servers to fail to join the cluster.

  • agent-token
  • cluster-cidr
  • cluster-dns
  • cluster-domain
  • disable-cloud-controller
  • disable-kube-proxy
  • egress-selector-mode
  • service-cidr

Common

FlagDescriptionDefaultEnviroment Variable
configPath to config file/etc/rancher/rke2/config.yamlRKE2_CONFIG_FILE
debugTurn on debug logsRKE2_DEBUG
data-dirFolder to hold state"/var/lib/rancher/rke2"

Listener

FlagDescriptionDefault
bind-addressrke2 bind address0.0.0.0
advertise-addressIPv4/IPv6 address that apiserver uses to advertise to members of the clusternode-external-ip/node-ip
tls-sanAdd additional hostnames or IPv4/IPv6 addresses as Subject Alternative Names on the server TLS cert
tls-san-securityProtect the server TLS cert by refusing to add Subject Alternative Names not associated with the kubernetes apiserver service, server nodes, or values of the tls-san optiontrue

Networking

FlagDescriptionDefaultEnviroment Variable
cluster-cidrIPv4/IPv6 network CIDRs to use for pod IPs10.42.0.0/16
service-cidrIPv4/IPv6 network CIDRs to use for service IPs10.43.0.0/16
service-node-port-rangePort range to reserve for services with NodePort visibility"30000-32767"
cluster-dnsIPv4 Cluster IP for coredns service. Should be in your service-cidr range10.43.0.10
cluster-domainCluster Domain"cluster.local"
egress-selector-modeOne of 'agent', 'cluster', 'pod', 'disabled'"agent"
servicelb-namespaceNamespace of the pods for the servicelb component"kube-system"
cniCNI Plugins to deploy, one of none, calico, canal, cilium; optionally with multus as the first value to enable the multus meta-plugincanalRKE2_CNI

Client

FlagDescriptionEnviroment Variable
write-kubeconfigWrite kubeconfig for admin client to this fileRKE2_KUBECONFIG_OUTPUT
write-kubeconfig-modeWrite kubeconfig with this modeRKE2_KUBECONFIG_MODE

Helm

FlagDescription
helm-job-imageDefault image to use for helm jobs

Cluster

FlagDescriptionEnviroment Variable
tokenShared secret used to join a server or agent to a clusterRKE2_TOKEN
token-fileFile containing the tokenRKE2_TOKEN_FILE
agent-tokenShared secret used to join agents to the cluster, but not serversRKE2_AGENT_TOKEN
agent-token-fileFile containing the agent secretRKE2_AGENT_TOKEN_FILE
serverServer to connect to, used to join a clusterRKE2_URL
cluster-resetForget all peers and become sole member of a new clusterRKE2_CLUSTER_RESET

Database

FlagDescriptionDefaultEnviroment Variable
cluster-reset-restore-pathPath to snapshot file to be restored
etcd-expose-metricsExpose etcd metrics to client interface.false
etcd-disable-snapshotsDisable automatic etcd snapshots
etcd-snapshot-nameSet the base name of etcd snapshotsetcd-snapshot-<unix-timestamp>)
etcd-snapshot-schedule-cronSnapshot interval time in cron spec. eg. every 5 hours '0 */5 * * *'"0 */12 * * *"
etcd-snapshot-retentionNumber of snapshots to retain5
etcd-snapshot-dirDirectory to save db snapshots.${data-dir}/db/snapshots
etcd-snapshot-compressCompress etcd snapshot
etcd-s3Enable backup to S3
etcd-s3-endpointS3 endpoint url"s3.amazonaws.com"
etcd-s3-endpoint-caS3 custom CA cert to connect to S3 endpoint
etcd-s3-skip-ssl-verifyDisables S3 SSL certificate validation
etcd-s3-access-keyS3 access keyAWS_ACCESS_KEY_ID
etcd-s3-secret-keyS3 secret keyAWS_SECRET_ACCESS_KEY
etcd-s3-bucketS3 bucket name
etcd-s3-regionS3 region / bucket location (optional)"us-east-1"
etcd-s3-folderS3 folder
etcd-s3-insecureDisables S3 over HTTPS
etcd-s3-timeoutS3 timeout5m0s

Flags

FlagDescription
kube-apiserver-argCustomized flag for kube-apiserver process
etcd-argCustomized flag for etcd process
kube-controller-manager-argCustomized flag for kube-controller-manager process
kube-scheduler-argCustomized flag for kube-scheduler process
kube-cloud-controller-manager-argCustomized flag for kube-cloud-controller-manager process

Components

FlagDescriptionEnviroment Variable
disableDo not deploy packaged components and delete any deployed components (valid items: rke2-coredns, rke2-ingress-nginx, rke2-metrics-server)
disable-schedulerDisable Kubernetes default scheduler
disable-cloud-controllerDisable rke2 default cloud controller manager
disable-kube-proxyDisable running kube-proxy
enable-servicelbEnable rke2 default cloud controller manager's service controllerRKE2_ENABLE_SERVICELB
control-plane-resource-requestsControl Plane resource requestsRKE2_CONTROL_PLANE_RESOURCE_REQUESTS
control-plane-resource-limitsControl Plane resource limitsRKE2_CONTROL_PLANE_RESOURCE_LIMITS
control-plane-probe-configurationControl Plane Probe configurationRKE2_CONTROL_PLANE_PROBE_CONFIGURATION
kube-apiserver-extra-mountkube-apiserver extra volume mountsRKE2_KUBE_APISERVER_EXTRA_MOUNT
kube-scheduler-extra-mountkube-scheduler extra volume mountsRKE2_KUBE_SCHEDULER_EXTRA_MOUNT
kube-controller-manager-extra-mountkube-controller-manager extra volume mountsRKE2_KUBE_CONTROLLER_MANAGER_EXTRA_MOUNT
kube-proxy-extra-mountkube-proxy extra volume mountsRKE2_KUBE_PROXY_EXTRA_MOUNT
etcd-extra-mountetcd extra volume mountsRKE2_ETCD_EXTRA_MOUNT
cloud-controller-manager-extra-mountcloud-controller-manager extra volume mountsRKE2_CLOUD_CONTROLLER_MANAGER_EXTRA_MOUNT
kube-apiserver-extra-envkube-apiserver extra environment variablesRKE2_KUBE_APISERVER_EXTRA_ENV
kube-scheduler-extra-envkube-scheduler extra environment variablesRKE2_KUBE_SCHEDULER_EXTRA_ENV
kube-controller-manager-extra-envkube-controller-manager extra environment variablesRKE2_KUBE_CONTROLLER_MANAGER_EXTRA_ENV
kube-proxy-extra-envkube-proxy extra environment variablesRKE2_KUBE_PROXY_EXTRA_ENV
etcd-extra-envetcd extra environment variablesRKE2_ETCD_EXTRA_ENV
cloud-controller-manager-extra-envcloud-controller-manager extra environment variablesRKE2_CLOUD_CONTROLLER_MANAGER_EXTRA_ENV

Image

FlagDescriptionEnviroment Variable
kube-apiserver-imageOverride image to use for kube-apiserverRKE2_KUBE_APISERVER_IMAGE
kube-controller-manager-imageOverride image to use for kube-controller-managerRKE2_KUBE_CONTROLLER_MANAGER_IMAGE
cloud-controller-manager-imageOverride image to use for cloud-controller-managerRKE2_CLOUD_CONTROLLER_MANAGER_IMAGE
kube-proxy-imageOverride image to use for kube-proxyRKE2_KUBE_PROXY_IMAGE
kube-scheduler-imageOverride image to use for kube-schedulerRKE2_KUBE_SCHEDULER_IMAGE
pause-imageOverride image to use for pauseRKE2_PAUSE_IMAGE
runtime-imageOverride image to use for runtime binaries (containerd, kubectl, crictl, etc)RKE2_RUNTIME_IMAGE
etcd-imageOverride image to use for etcdRKE2_ETCD_IMAGE

Cloud Provider

FlagDescriptionEnviroment Variable
cloud-provider-nameCloud provider nameRKE2_CLOUD_PROVIDER_NAME
cloud-provider-configCloud provider configuration file pathRKE2_CLOUD_PROVIDER_CONFIG

Security

FlagDescriptionEnviroment Variable
profileValidate system configuration against the selected benchmark (valid items: cis, cis-1.23 (deprecated))RKE2_CIS_PROFILE
audit-policy-filePath to the file that defines the audit policy configurationRKE2_AUDIT_POLICY_FILE
pod-security-admission-config-filePath to the file that defines Pod Security Admission configurationRKE2_POD_SECURITY_ADMISSION_CONFIG_FILE

Experimental

FlagDescriptionEnviroment Variable
embedded-registryEnable embedded distributed container registry; requires use of embedded containerd
enable-pprofEnable pprof endpoint on supervisor port
kubelet-pathOverride kubelet binary pathRKE2_KUBELET_PATH

Agent/Node

FlagDescriptionDefaultEnviroment Variable
node-nameNode nameRKE2_NODE_NAME
with-node-idAppend id to node name
node-labelRegistering and starting kubelet with set of labels
node-taintRegistering kubelet with set of taints
image-credential-provider-bin-dirThe path to the directory where credential provider plugin binaries are located"/var/lib/rancher/credentialprovider/bin"
image-credential-provider-configThe path to the credential provider plugin config file"/var/lib/rancher/credentialprovider/config.yaml"
protect-kernel-defaultsKernel tuning behavior. If set, error if kernel tunables are different than kubelet defaults.
selinuxEnable SELinux in containerdRKE2_SELINUX
lb-server-portLocal 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.6444RKE2_LB_SERVER_PORT

Agent/Runtime

FlagDescriptionDefaultEnviroment Variable
container-runtime-endpointDisable embedded containerd and use the CRI socket at the given path; when used with --docker this sets the docker socket path
default-runtimeSet the default runtime in containerd
snapshotterOverride default containerd snapshotter"overlayfs"
private-registryPrivate registry configuration file"/etc/rancher/rke2/registries.yaml"
system-default-registryPrivate registry to be used for all system imagesRKE2_SYSTEM_DEFAULT_REGISTRY

Agent/Containerd

FlagDescription
disable-default-registry-endpointDisables containerd's fallback default registry endpoint when a mirror is configured for that registry

Agent/Networking

FlagDescriptionEnviroment Variable
node-ipIPv4/IPv6 addresses to advertise for node
node-external-ipIPv4/IPv6 external IP addresses to advertise for node
resolv-confKubelet resolv.conf fileRKE2_RESOLV_CONF

Agent/Flags

FlagDescription
kubelet-argCustomized flag for kubelet process
kube-proxy-argCustomized flag for kube-proxy process