简体   繁体   English

独立的Jenkins与Kubernetes Cluster建立集成

[英]Standalone Jenkins build integration with Kubernetes Cluster

I am working on running a build job on my Jenkins to deploy an image to Kubernetes cluster. 我正在Jenkins上运行构建作业,以将映像部署到Kubernetes集群。 I have a Java Microservice application and I am using fabric8 to build the docker image and push it to a private repository. 我有一个Java Microservice应用程序,正在使用fabric8构建docker映像并将其推送到私有存储库。

I am facing issues while running fabric8:deploy. 我在运行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. 根据公司规定,我无法在Jenkins主机上安装kubectl。 I'd like to be able to make my fabric8:deploy work. 我希望能够使我的fabric8:deploy工作。 How can I achieve connection between Jenkins and Kubernetes? 我如何实现Jenkins和Kubernetes之间的联系? I am not sure if Jenkins nodes is an option. 我不确定是否可以选择Jenkins节点。 Appreciate your ideas. 欣赏你的想法。

TIA TIA

Another way to provide authentication credential for Kubernetes/OpenShift cluster is to set environment variables. 为Kubernetes / OpenShift集群提供身份验证凭据的另一种方法是设置环境变量。

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. 由于Jenkins在运行时受到一些公司限制。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM