I am working on running a build job on my Jenkins to deploy an image to Kubernetes cluster. I have a Java Microservice application and I am using fabric8 to build the docker image and push it to a private repository.
I am facing issues while running fabric8:deploy. Below are the error messages.
[ERROR] F8: Could not connect to kubernetes cluster!
[ERROR] F8: Have you started a local cluster via `mvn fabric8:cluster- start` or connected to a remote cluster via `kubectl`?
[INFO] F8: For more help see: http://fabric8.io/guide/getStarted/
[ERROR] F8: Connection error: %s: java.net.UnknownHostException: kubernetes.default.svc
I cannot install kubectl on my Jenkins host due to corporate regulations. I'd like to be able to make my fabric8:deploy
work. How can I achieve connection between Jenkins and Kubernetes? I am not sure if Jenkins nodes is an option. Appreciate your ideas.
TIA
Another way to provide authentication credential for Kubernetes/OpenShift cluster is to set environment variables.
KUBERNETES_MASTER - > Master URL for k8s
KUBERNETES_AUTH_BASIC_USERNAME
KUBERNETES_AUTH_BASIC_PASSWORD
Can you try this?
Since Jenkins is running with some corporate restrictions. In case it's running behind firewall and getting connection issues, optionally you may like to configure proxy with the following environment variables
HTTPS_PROXY
HTTPS_PROXY
PROXY_USERNAME
PROXY_PASSWORD
NO_PROXY