This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.


Feature Flags in Kubernetes Applications

Feature flags are used to change the behavior of a program at runtime without forcing a restart.

Although they are essential in a native cloud environment, they cannot be implemented without significant effort on some platforms. Kubernetes has made this trivial. Here we will implement them through labels and annotations, but you can also implement them by connecting directly to the Kubernetes API Server.


Possible Use Cases

  • Turn on/off a specific instance
  • Turn on/off the profiling of a specific instance
  • Change the logging level, to capture detailed logs during a specific event
  • Change caching strategy at runtime
  • Change timeouts in production
  • Toggle on/off some special verification

Organizing Access Using kubeconfig Files

The kubectl command-line tool uses kubeconfig files to find the information it needs in order to choose a cluster and communicate with its API server.


What happens if the kubeconfig file of your production cluster is leaked or published by accident?

Since there is no possibility to rotate or revoke the initial kubeconfig, there is only one way to protect your infrastructure or application if the kubeconfig has leaked - delete the cluster.

Learn more on Organizing Access Using kubeconfig Files.