Request for classic confinement: kubectx

The personal-files interface can be used for this. Eg:

name: kubectx

plugs:
  dot-kube-config:
    interface: personal-files
    write:
    - $HOME/.kube/config
    - $HOME/.kube/config.lock

apps:
  kubectx:
    plugs:
    - dot-kube-config

There are other applications that modify ~/.kube/config in this manner in the store. See The personal-files interface for details.