Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Failed To Deploy to Kubernetes Cluster Due to Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized. #1349

Closed
ruigulala opened this issue Aug 1, 2018 · 6 comments
Labels
cat/bug Bug which needs fixing cat/triage To be verified or triaged. group/kubernetes Kubernetes related issue status/stale Issue/PR considered to be stale

Comments

@ruigulala
Copy link

ruigulala commented Aug 1, 2018

Description

When I was trying to deploy the following project, I'm having an 401.
https://bitbucket.org/employersappdev/ssldemo.git

Info

Caused by: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://api.ruig-maven-3446ee10-951b-11e8-9617-02418d964b18.cascade-dev.cascade-domain.com/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized.
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure (OperationSupport.java:472)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode (OperationSupport.java:409)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse (OperationSupport.java:381)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse (OperationSupport.java:344)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse (OperationSupport.java:328)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getRootPaths (BaseOperation.java:215)
at io.fabric8.kubernetes.client.BaseClient.rootPaths (BaseClient.java:140)
at io.fabric8.kubernetes.api.KubernetesHelper.isOpenShift (KubernetesHelper.java:2191)
at io.fabric8.maven.plugin.mojo.build.ApplyMojo.executeInternal (ApplyMojo.java:336)
at io.fabric8.maven.plugin.mojo.AbstractFabric8Mojo.execute (AbstractFabric8Mojo.java:74)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)

However, when I try to reproduce it using curl, I got the correct response.

curl -ik https://api.ruig-maven-3446ee10-951b-11e8-9617-02418d964b18.cascade-dev.cascade-domain.com:443 -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJydWblablabla"

The token is stored in .kube/config.

  • f-m-p version : 3.5.40
  • Maven version (mvn -v) : 3.5.2

  • Kubernetes / OpenShift setup and version : 1.10.2
  • If it's a bug, how to reproduce :
  1. Download source code from https://bitbucket.org/employersappdev/ssldemo.git
  2. Make sure the kubernetes cluster is logged in(run kubectl get pods).
  3. Run mvn package fabric8:build fabric8:deploy
  • If it's a feature request, what is your use case :
  • Sample project : [https://bitbucket.org/employersappdev/ssldemo.git]
@rhuss
Copy link
Contributor

rhuss commented Aug 1, 2018

Do you also have the right context set ? Can you do a kubectl get pods on the same shell ?

@rohanKanojia rohanKanojia added cat/bug Bug which needs fixing group/kubernetes Kubernetes related issue cat/triage To be verified or triaged. labels Aug 2, 2018
@ruigulala
Copy link
Author

Yes, kubectl get pods works as expected.
In the kubectl config, we're using --embed-certs=false. Not sure if this causes the problem.

@stale
Copy link

stale bot commented Oct 31, 2018

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

@stale stale bot added the status/stale Issue/PR considered to be stale label Oct 31, 2018
@stale stale bot closed this as completed Nov 7, 2018
@rhuss
Copy link
Contributor

rhuss commented Nov 8, 2018

@ruigulala sorry for the delay. If this is still an issue (is it ?), we should investigste it of course.

@rhuss rhuss reopened this Nov 8, 2018
@stale stale bot removed the status/stale Issue/PR considered to be stale label Nov 8, 2018
@stale
Copy link

stale bot commented Feb 6, 2019

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

@stale stale bot added the status/stale Issue/PR considered to be stale label Feb 6, 2019
@stale stale bot closed this as completed Feb 13, 2019
@egor-ryashin
Copy link

Got that exception several times in a row and then it's just gone. I believe it relates more to K8s service not the client.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cat/bug Bug which needs fixing cat/triage To be verified or triaged. group/kubernetes Kubernetes related issue status/stale Issue/PR considered to be stale
Projects
None yet
Development

No branches or pull requests

4 participants