This page shows how to enable or disable feature gates to control specific Kubernetes features in your cluster. Enabling feature gates allows you to test and use Alpha or Beta features before they become generally available.
You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using minikube or you can use one of these Kubernetes playgrounds:
You also need:
Before enabling a feature gate, check the Feature Gates reference for the feature's maturity level:
Different feature gates affect different Kubernetes components:
The Feature Gates reference typically indicates which components are affected by each gate. All Kubernetes components share the same feature gate definitions, so all gates appear in help output, but only relevant gates affect each component's behavior.
Create a configuration file to enable feature gates across relevant components:
apiVersion: kubeadm.k8s.io/v1beta4
kind: ClusterConfiguration
apiServer:
extraArgs:
feature-gates: "FeatureName=true"
controllerManager:
extraArgs:
feature-gates: "FeatureName=true"
scheduler:
extraArgs:
feature-gates: "FeatureName=true"
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
featureGates:
FeatureName: true
Initialize the cluster:
kubeadm init --config kubeadm-config.yaml
For kubeadm clusters, feature gate configuration can be set in several locations including manifest files, configuration files, and kubeadm configuration.
Edit control plane component manifests in /etc/kubernetes/manifests/:
For kube-apiserver, kube-controller-manager, or kube-scheduler, add the flag to the command:
spec:
containers:
- command:
- kube-apiserver
- --feature-gates=FeatureName=true
# ... other flags
Save the file. The pod restarts automatically.
For kubelet, edit /var/lib/kubelet/config.yaml:
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
featureGates:
FeatureName: true
Restart kubelet:
sudo systemctl restart kubelet
For kube-proxy, edit the ConfigMap:
kubectl -n kube-system edit configmap kube-proxy
Add feature gates to the configuration:
featureGates:
FeatureName: true
Restart the DaemonSet:
kubectl -n kube-system rollout restart daemonset kube-proxy
Use comma-separated lists for command-line flags:
--feature-gates=FeatureA=true,FeatureB=false,FeatureC=true
For components that support configuration files (kubelet, kube-proxy):
featureGates:
FeatureA: true
FeatureB: false
FeatureC: true
/etc/kubernetes/manifests/. While these components support
configuration files via the --config flag, kubeadm primarily uses command-line flags.After configuring, verify the feature gates are active. The following methods apply to kubeadm clusters where control plane components run as static pods.
View the feature gates configured in the static pod manifest:
kubectl -n kube-system get pod kube-apiserver-<node-name> -o yaml | grep feature-gates
Use the kubelet's configz endpoint:
kubectl proxy --port=8001 &
curl -sSL "http://localhost:8001/api/v1/nodes/<node-name>/proxy/configz" | grep featureGates -A 5
Or check the configuration file directly on the node:
cat /var/lib/kubelet/config.yaml | grep -A 10 featureGates
Feature gate status is exposed in Prometheus-style metrics by Kubernetes components (available in Kubernetes 1.26+). Query the metrics endpoint to verify which feature gates are enabled:
kubectl get --raw /metrics | grep kubernetes_feature_enabled
To check a specific feature gate:
kubectl get --raw /metrics | grep kubernetes_feature_enabled | grep FeatureName
The metric shows 1 for enabled gates and 0 for disabled gates.
If you have access to a component's debugging endpoints, and the ComponentFlagz
feature gate is enabled for that component, you can inspect the command-line flags
that were used to start the component by visiting the /flagz endpoint. Feature
gates configured using command-line flags appear in this output.
The /flagz endpoint is part of Kubernetes z-pages, which provide human-readable
runtime debugging information for core components.
For more information, see the z-pages documentation.
Some examples of component-specific feature gates:
StructuredAuthenticationConfiguration primarily affect kube-apiserverGracefulNodeShutdown primarily affect kubeletAlways test feature gates in non-production environments first. Alpha features may be removed without notice.