Azure/AKS

az aks get-credentials command change format of .kube/config causing maven fabric8 plugin to stop working

Closed this issue · 2 comments

Hello,

After running command "az aks get-credentials" file format C:\Users<user name>.kube\config is changed completely which cause "mvn fabric8:apply" command to fail as its not able to extract details from this to file to connect with kubernetes.

Could you please advise how to re-format config file to yaml again or how to avoid merge changing its format ? Eventually I could use kubectl config set-cluster, set-credentials and set-context to setup this manually however I would need to find out how cli command coming up with all parameters like for example user, certificate-authority-data...

error return by fabric 8:
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.38:apply (default-cli) on project gs-spring-boot-docker: Failure executing: GET at: https://.hcp.canadaeast.azmk8s.io/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized. -> [Help 1]

Old format of config file before running cli command:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: ...
    server: https://<cluster name>.hcp.westeurope.azmk8s.io:443
  name: aksdevwe
....

New format after running cli command:

{apiVersion: v1, clusters: [{cluster: {certificate-authority-data: ...
server: 'https://<server name>.hcp.westeurope.azmk8s.io:443'}, name: <server name>},
slack commented

Workaround: Using kubectl to update config will re-format as YAML: kubectl config use-context <...>

We can take a look at how we are merging the configuration /cc @mboersma

Thanks ! it will do the job for me, switching context will be something done daily so format will be rectified anyway.