Kubernetes contexts in Aptakube

This article explains how Aptakube loads Kubernetes contexts and how you can fix issues with loading contexts.

Aptakube uses the same rules as Kubectl when it comes to loading contexts. In most of cases, if you're already using Kubectl, Aptakube will load your Kubernetes contexts automatically and it'll just work. But if you have a slighly different setup, you might need some extra configuration to load your contexts.

If you're not familiar with Kubeconfig, you can learn more about it in our Kubeconfig Guide. You can also follow these guides on how to download Kubeconfig for popular managed services: GKE, EKS and AKS.

These are the rules and order in which Aptakube loads contexts:

1. $APTAKUBECONFIG environment variable

This is a custom environment variable used by Aptakube to load contexts. If this variable is set, Aptakube will load contexts from the file specified in this variable. The content of this variable follows the same rules as the standard KUBECONFIG environment variable, which means that multiple files are supported.

We recommend using this setting only if you want to automatically load different contexts for aptakube and kubectl, otherwise use the standard KUBECONFIG environment variable.


  • Single config file: APTAKUBECONFIG=~/workspace/config1
  • Multiple config files: APTAKUBECONFIG=~/workspace/config1:~/path/to/config2

2. $KUBECONFIG environment variable

This is the standard environment variable used by both Aptakube and Kubectl to load contexts. Multiple files are also supported.


  • Single config file: KUBECONFIG=~/workspace/config1
  • Multiple config files: KUBECONFIG=~/workspace/config1:~/path/to/config2

3. ~/.kube/config default path

This is the standard default path used by both Aptakube and Kubectl to load contexts. If none of the variables above are set, Aptakube will try to load contexts from this file.

If you need help with your setup, contact us at GitHub or hello@aptakube.com.