Azure / Azure/azure-libraries-for-java

[BUG] Kubernetes cluster returns 401

Open
#774 2 comments 0 reactions 0 assignees View on GitHub
AKS customer-reported Mgmt needs-more-info
Dominant language
Java
Stars
97
Forks
102
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Kubernetes returns 401 error for every connection attempt. The most weird part is that this application worked fine more than a week ago(20.06.19). I use the azureauth.properties to access the cloud. kubeconfig is retrieved using adminKubeConfigConent().
This array is passed to Skuber API for the deployment of other needful components.
***Exception or Stack Trace***
`[INFO] [07/02/2019 14:22:13.993] [wtf-akka.actor.default-dispatcher-7] [skuber.api] [ { reqId=daf65bf9-3931-4a20-bc37-c731aa2c4879} } - received response with HTTP status 401]
[INFO] [07/02/2019 14:22:13.995] [wtf-akka.actor.default-dispatcher-8] [skuber.api] [Response: non-ok status returned - Status(v1,Status,ListMeta(,,None),Some(Failure),Some(Unauthorized),Some(Unauthorized),None,Some(401))`
**To Reproduce**
1. Create a new service principal
2. Create a cluster
3. Try to access a cluster using an admin kubeconfig file.
***Code Snippet***
` private val azure = Azure
.configure()
.authenticate(new File(getClass.getResource(authFile).getPath))
.withDefaultSubscription()`

` observableToFuture(
azure
.kubernetesClusters()
.define(cluster.name)
.withRegion(cluster.region.name)
.withExistingResourceGroup(cluster.group)
.withLatestVersion()
.withRootUsername(rootUser)
.withSshKey(generateSSHKey(cluster.group))
.withServicePrincipalClientId(clientId)
.withServicePrincipalSecret(secret)
.defineAgentPool(cluster.name)
.withVirtualMachineSize(ContainerServiceVMSizeTypes.fromString(cluster.configuration.vm.vmSize))
.withAgentPoolVirtualMachineCount(cluster.configuration.kafkaNodeAmount + cluster.configuration.zookeeperNodeAmount)
.withOSDiskSizeInGB(nodeDiskSize)
.attach()
.withDnsPrefix(cluster.group)
.createAsync()
).mapTo[KubernetesCluster]`

` private def getKubernetesConfig(clusterChain: ClusterChain): ConfigChain =
mapRight[KubernetesCluster, Array[Byte]](clusterChain, cluster => cluster.adminKubeConfigContent())`

` private val k8sConf =
K8SConfiguration.parseKubeconfigStream(new ByteArrayInputStream(kubeconfig)).fold(Future.failed, Future.successful)`

**Setup (please complete the following information):**
- OS: Linux
- IDE : Intellij Idea
- Version of the Library used: 1.22

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.