k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Switch used cloud account pre-connect to k8s instance

Open lukeb2e opened this issue 2 years ago • 2 comments




Is your feature request related to a problem? Please describe. We have multiple k8s clusters in multiple regions, spanning multiple azure clouds (Azure Global, China, ...). The authorization to access the cluster is connected to the region specific account. Due to Azure China having a seperate user management from Azure Global the connection fails. K9S throws an error that it is unable to connect to the cluster.

To access the other cluster, I need to manually enter the command az cloud set --name AzureCloud. Afterwards a connection to the appropriate cluster is possible.

Describe the solution you'd like I would like to let k9s execute the az cloud set command automatically when switching k8s clusters to the appropriate account automatically. Eg a pre-connect command that would execute the command az cloud set --name AzureCloud before connecting to a cluster in Azure Global.

Describe alternatives you've considered Currently the workaround is to close k9s, enter the az cloud set command, and reopen k9s. This is frustrating, especially in on-call situations. I did check if there is a shorthand to execute a command similar to vim's shell, but was unable to find one.

Additional context

lukeb2e avatar May 24 '22 12:05 lukeb2e

i'm unfamiliar with Azure, but with AWS EKS this is done from within the kube config file, so check if that is possible with Azure as well:

users:
- name: test
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - --region
      - ap-southeast-2
      - eks
      - get-token
      - --cluster-name
      - prod
      - --output
      - json
      command: aws
      env:
      - name: AWS_PROFILE
        value: test 
      interactiveMode: IfAvailable
      provideClusterInfo: false

dudicoco avatar Dec 04 '23 10:12 dudicoco

an addition of something like --aws-profile profile_name would be great.

omerls-pw avatar Dec 20 '23 15:12 omerls-pw