Quarkus problem -> getting warning from quarkus-maven-plugin

6/9/2021

Recently I got this warning message, when I have builded quarkus maven project. I have tested with several later versions and I think this has to be something local in my environment.

[WARNING] Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring

And this result in a build failure ...

[error]: Build step io.quarkus.kubernetes.deployment.KubernetesDeployer#deploy threw an exception: java.lang.RuntimeException: 

Although Kubernetes deployment was requested, it however cannot take place, because there was an error during communication with the API Server at https://kubernetes.default.svc/

Any ideas what could be wrong?

-- Tapani Rundgren
kubernetes
quarkus

2 Answers

6/9/2021

For deployment to Kubernetes to work, you need to be able to communicate with the target cluster.

If you can communicate with the cluster using kubectl, then Quarkus will be able to deploy to that cluster as well.

You can also override your local k8s settings for Quarkus specifically, see https://quarkus.io/guides/kubernetes-client#configuration-reference

-- geoand
Source: StackOverflow

6/9/2021

Like Tapani Rundgren mentioned in the comments, the solution is to export the variables:

export KUBERNETES_MASTER=<your server here>
export KUBERNETES_NAMESPACE=<your namspace here>
-- Mikołaj Głodziak
Source: StackOverflow