Daniel's Tech Blog

Cloud Computing, Cloud Native & Kubernetes

Show enabled feature gates on an Azure Kubernetes Service cluster

Recently, I needed to check which feature gates are active on an Azure Kubernetes Service cluster running Kubernetes version 1.29.0. In particular, the SidecarContainers feature gate brings support for running sidecar containers as init containers. For instance, a service mesh proxy container now starts before the main container and solves a couple of issues with service mesh proxies in Kubernetes.

The SidecarContainers feature gate was introduced in Kubernetes version 1.28 as an alpha version and graduated to beta with Kubernetes version 1.29.

-> https://kubernetes.io/blog/2023/08/25/native-sidecar-containers/

Microsoft is saying that per default beta feature gates are enabled on Azure Kubernetes Service. But I wanted to be sure upfront before trying out the new init containers implementation.

So, I ran a search engine query and came across a Kubernetes GitHub issue and the Google Cloud Platform documentation.

-> https://github.com/kubernetes/kubernetes/issues/87869#issuecomment-1465634605
-> https://cloud.google.com/kubernetes-engine/docs/concepts/feature-gates#check-feature-gate-state

Since Kubernetes version 1.26 and later, feature gates information is available via the /metrics endpoint as a gauge. A one indicates the feature gate is enabled, and a zero indicates it is disabled.

I ran the following command to determine if the SidecarContainers feature gate is enabled on Azure Kubernetes Service running Kubernetes version 1.29.

❯ kubectl get --raw /metrics | grep kubernetes_feature_enabled | grep Sidecar
kubernetes_feature_enabled{name="SidecarContainers",stage="BETA"} 1

When you want to show all feature gates, remove the last grep command to get the entire list.

❯ kubectl get --raw /metrics | grep kubernetes_feature_enabled
# HELP kubernetes_feature_enabled [BETA] This metric records the data about the stage and enablement of a k8s feature.
# TYPE kubernetes_feature_enabled gauge
kubernetes_feature_enabled{name="APIListChunking",stage=""} 1
kubernetes_feature_enabled{name="APIPriorityAndFairness",stage=""} 1
kubernetes_feature_enabled{name="APIResponseCompression",stage="BETA"} 1
kubernetes_feature_enabled{name="APISelfSubjectReview",stage=""} 1
kubernetes_feature_enabled{name="APIServerIdentity",stage="BETA"} 1
...
kubernetes_feature_enabled{name="WatchList",stage="ALPHA"} 0
kubernetes_feature_enabled{name="WinDSR",stage="ALPHA"} 0
kubernetes_feature_enabled{name="WinOverlay",stage="BETA"} 1
kubernetes_feature_enabled{name="WindowsHostNetwork",stage="ALPHA"} 1
kubernetes_feature_enabled{name="ZeroLimitedNominalConcurrencyShares",stage="BETA"} 0

Posted

in

WordPress Cookie Notice by Real Cookie Banner