Context Extension in Aptakube

Use kubeconfig extensions to customize contexts in Aptakube

Aptakube supports context configuration with the use of a custom extension named aptakube in your kubeconfig file. This extension allow developers to customize the icon and order of the context in the Aptakube UI, with more features to come in the future.

This extension is supported starting from Aptakube 1.6.3, and must be added to the context object in your Kubeconfig, not the cluster or user object. All fields are optional.

1. Context Name (Alias)

While Aptakube does not support custom context names, you can rename them using the standard name property in the context object.

In some cases developers use more than one Kubernetes tool, so having the same name consistent across all tools is important. Renaming a context in kubeconfig also makes usage of kubectl much easier when dealing with multiple clusters.

contexts:
  - context:
      cluster: minikube
      user: minikube
    name: minikube # You can rename the context here to whatever you like
clusters:
  - ...
users:
  - ...
current-context: minikube
kind: Config
preferences: {}

2. Group Context

Aptakube can connect to multiple clusters simultaneously, but that requires users to select the context they want to use at startup. To make this process easier, you can group contexts together in whatever way you like, such as by cloud provider or environment, and then connect to them all in a single click.

Use the tags field in the context extension, here's an example:

contexts:
  - context:
      cluster: minikube
      namespace: default
      user: minikube
      extensions:
        - name: aptakube
          extension:
            tags: [Production] # Multiple tags are supported
    name: minikube
clusters:
  - ...
users:
  - ...
current-context: minikube
kind: Config
preferences: {}

3. Custom Context Icon

Aptakube includes a set of built-in icons for common platforms like EKS, GKE, AKS, and others, but you can also use your own icons. This is useful if you have multiple clusters from the same cloud provider and want an easy way to distinguish between them.

Use the icon-url field in the context extension, here's an example:

contexts:
  - context:
      cluster: minikube
      namespace: default
      user: minikube
      extensions:
        - name: aptakube
          extension:
            icon-url: https://example.com/custom-icon.png
    name: minikube
clusters:
  - ...
users:
  - ...
current-context: minikube
kind: Config
preferences: {}

The icon-url field can be either a local file path or a remote URL. Here's an example of a local file path:

extensions:
  - name: aptakube
    extension:
      # macOS or Linux
      icon-url: /Users/username/Desktop/custom-icon.png
      # Windows
      # icon-url: C:\Users\username\Desktop\custom-icon.png

4. Ordered Contexts

You can also use the order field to specify the order of the context in the Aptakube UI. This is useful if you want to prioritize certain contexts over others.

The lower the order, the higher the priority it'll have on the UI. Here's an example:

contexts:
  - context:
      cluster: minikube
      namespace: default
      user: minikube
      extensions:
        - name: aptakube
          extension:
            order: 1
    name: minikube
clusters:
  - ...
users:
  - ...
current-context: minikube
kind: Config
preferences: {}

So what's next?

What else would you like to see in terms of context configuration in Aptakube?

Let us know by opening an issue on GitHub or joining our Discord.