Skip to content

[BUG]: Kubernetes@1 with kubernetesServiceEndpoint tries to use azureServiceEndpoint #20797

Open
@mluker

Description

New issue checklist

Task name

Kubernetes

Task version

@1

Issue Description

The following task using kubernetesServiceEndpoint seems to be using azureSubscriptionEndpoint based on the pipeline logs.

I need a way to use the kubernetesServiceConnection to login and be able to write out a .kube/config so it can be used later in a terraform provider block.

- task: Kubernetes@1
    inputs:
      connectionType: 'Kubernetes Service Connection'
      kubernetesServiceEndpoint: ${{ parameters.aksServiceConnection }}
      command: login
    displayName: 🔓 AKS Login
##[debug]found: '/mnt/vss/_work/_temp/*/bin/linux_amd64/kubelogin'
##[debug]Kubelogin is installed. Converting kubeconfig.
**##[debug]azureSubscriptionEndpoint=undefined**
##[debug]undefined auth scheme = undefined
##[debug]Kubelogin authentication scheme undefined
##[debug]Kubelogin authentication failed. Exception: TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at Kubelogin.<anonymous> (/mnt/vss/_work/_tasks/Kubernetes_cbc*/1.247.3/node_modules/azure-pipelines-tasks-kubernetes-common/kubelogin.js:37:28)
    at Generator.next (<anonymous>)
    at /mnt/vss/_work/_tasks/Kubernetes_*/1.247.3/node_modules/azure-pipelines-tasks-kubernetes-common/kubelogin.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/mnt/vss/_work/_tasks/Kubernetes_cbc*/1.247.3/node_modules/azure-pipelines-tasks-kubernetes-common/kubelogin.js:4:12)
    at Kubelogin.login (/mnt/vss/_work/_tasks/Kubernetes_cbc*/1.247.3/node_modules/azure-pipelines-tasks-kubernetes-common/kubelogin.js:34:16)
    at ClusterConnection.<anonymous> (/mnt/vss/_work/_tasks/Kubernetes_cbc316a2-586f-4def-be79-488a1f503564/1.247.3/src/clusterconnection.js:79:41)
    at Generator.next (<anonymous>)
    at /mnt/vss/_work/_tasks/Kubernetes_cbc*/1.247.3/src/clusterconnection.js:8:71
    at new Promise (<anonymous>)
##[debug]which '/usr/bin/kubectl'
##[debug]found: '/usr/bin/kubectl'
##[debug]/usr/bin/kubectl arg: version
##[debug]/usr/bin/kubectl arg: ["-o","json"]
##[debug]exec tool: /usr/bin/kubectl
##[debug]arguments:
##[debug]   version
##[debug]   -o
##[debug]   json```

### Environment type (Please select at least one enviroment where you face this issue)

- [ ] Self-Hosted
- [x] Managed DevOps Pools
- [ ] VMSS Pool
- [ ] Container

### Operation system

ubuntu-latest

### Relevant log output

```shell
##[debug]which 'kubelogin'
##[debug]found: '/mnt/vss/_work/_temp/*/bin/linux_amd64/kubelogin'
##[debug]Kubelogin is installed. Converting kubeconfig.
**##[debug]azureSubscriptionEndpoint=undefined**
##[debug]undefined auth scheme = undefined
##[debug]Kubelogin authentication scheme undefined
##[debug]Kubelogin authentication failed. Exception: TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at Kubelogin.<anonymous> (/mnt/vss/_work/_tasks/Kubernetes_cbc*/1.247.3/node_modules/azure-pipelines-tasks-kubernetes-common/kubelogin.js:37:28)
    at Generator.next (<anonymous>)
    at /mnt/vss/_work/_tasks/Kubernetes_*/1.247.3/node_modules/azure-pipelines-tasks-kubernetes-common/kubelogin.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/mnt/vss/_work/_tasks/Kubernetes_cbc*/1.247.3/node_modules/azure-pipelines-tasks-kubernetes-common/kubelogin.js:4:12)
    at Kubelogin.login (/mnt/vss/_work/_tasks/Kubernetes_cbc*/1.247.3/node_modules/azure-pipelines-tasks-kubernetes-common/kubelogin.js:34:16)
    at ClusterConnection.<anonymous> (/mnt/vss/_work/_tasks/Kubernetes_cbc316a2-586f-4def-be79-488a1f503564/1.247.3/src/clusterconnection.js:79:41)
    at Generator.next (<anonymous>)
    at /mnt/vss/_work/_tasks/Kubernetes_cbc*/1.247.3/src/clusterconnection.js:8:71
    at new Promise (<anonymous>)
##[debug]which '/usr/bin/kubectl'
##[debug]found: '/usr/bin/kubectl'
##[debug]/usr/bin/kubectl arg: version
##[debug]/usr/bin/kubectl arg: ["-o","json"]
##[debug]exec tool: /usr/bin/kubectl
##[debug]arguments:
##[debug]   version
##[debug]   -o
##[debug]   json
```

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions