failed to create secret Unauthorized Azure AKS

Rehaan 26 Reputation points
2023-02-13T12:59:23.1133333+00:00

Hi

I am getting the below error upon running the Task of type KubernetesManifest and CreateSecret Action. It was working fine but suddenly it shows the below error.

Thanks

Starting: KubernetesManifest

==============================================================================

Task : Deploy to Kubernetes

Description : Use Kubernetes manifest files to deploy to clusters or even bake the manifest files to be used for deployments using Helm charts

Version : 0.212.0

Author : Microsoft Corporation

Help : https://aka.ms/azpipes-k8s-manifest-tsg

Kubectl Client Version: v1.26.1

Kubectl Server Version: Could not find kubectl server version

/usr/local/bin/kubectl delete secret k8sexamplesacrauth --insecure-skip-tls-verify --namespace dev

E0213 11:23:38.679583 1587 memcache.go:238] couldn't get current server API group list: the server has asked for the client to provide credentials

E0213 11:23:38.707383 1587 memcache.go:238] couldn't get current server API group list: the server has asked for the client to provide credentials

E0213 11:23:38.735107 1587 memcache.go:238] couldn't get current server API group list: the server has asked for the client to provide credentials

E0213 11:23:38.763074 1587 memcache.go:238] couldn't get current server API group list: the server has asked for the client to provide credentials

E0213 11:23:38.790777 1587 memcache.go:238] couldn't get current server API group list: the server has asked for the client to provide credentials

error: You must be logged in to the server (the server has asked for the client to provide credentials)

/usr/local/bin/kubectl create secret docker-registry k8sexamplesacrauth .......

error: failed to create secret Unauthorized

##[error]error: failed to create secret Unauthorized

Finishing: KubernetesManifest

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,373 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Akram Kathimi 1,206 Reputation points Microsoft Employee
    2023-02-14T08:20:15.89+00:00

    Hi @Rehaan ,

    Thank you for your question.

    From this log in the beginning: Kubectl Server Version: Could not find kubectl server version

    we can see that the server is not connected.

    Make sure your AKS cluster is in a healthy/started state, and make sure that you have the most recent "kubeconfig" file.

    Thank you.


  2. Rehaan 26 Reputation points
    2023-02-14T16:35:40.25+00:00

    I got it working by updating Kubernetes version and creating a new service connection based on kube config.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.