gpt4 book ai didi

jenkins - 无法为Jenkins设置Kubernetes插件

转载 作者:行者123 更新时间:2023-12-02 11:45:28 39 4
gpt4 key购买 nike

我有一个带有两个节点的全新Kubernetes v1.8集群(已启用RBAC)。 Jenkins被部署为StatefulSet,并且还创建了推荐的ServiceAccount / Role和RoleBindings(from here)。集群信息:

$ kubectl cluster-info
Kubernetes master is running at https://10.182.255.35:6443

当我尝试在Jenkins设置中设置Kubernetes云时,出现错误403(禁止访问)。我遵循了pugin指南,并在Jenkins中创建了“Kubernetes服务帐户”凭据,并尝试配置新的云。 Jenkins configuration screenshot。这是插件的调试日志:
Nov 02, 2017 7:40:57 PM FINE org.csanchez.jenkins.plugins.kubernetes.KubernetesFactoryAdapter
Creating Kubernetes client: KubernetesFactoryAdapter [serviceAddress=https://10.182.255.35:6443, namespace=default, caCertData=null, credentials=org.csanchez.jenkins.plugins.kubernetes.ServiceAccountCredential@99ee54b6, skipTlsVerify=true, connectTimeout=0, readTimeout=0]
Nov 02, 2017 7:40:57 PM FINE org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud
Error connecting to https://10.182.255.35:6443
java.io.IOException: Unexpected response code for CONNECT: 403
at okhttp3.internal.connection.RealConnection.createTunnel(RealConnection.java:371)
...(skipped)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(BaseOperation.java:605)
Caused: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [list] for kind: [Pod] with name: [null] in namespace: [default] failed.
at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:62)
...(skipped)

同时,如果我尝试使用Pod中的serviceAccount进行API调用,那么它可以正常工作:
$ kubectl exec -ti jenkins-0 bash (ssh into the pod)
bash-4.3$ KUBE_TOKEN=$(</var/run/secrets/kubernetes.io/serviceaccount/token)
bash-4.3$ curl -sSk -H "Authorization: Bearer $KUBE_TOKEN"
https://10.182.255.35:6443/api/v1/namespaces/default/pods
{
"kind": "PodList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces/default/pods",
"resourceVersion": "90645"
},
"items": [
{
...(skipped)

最佳答案

回答我自己的问题:问题出在我的代理设置上。在群集设置期间,需要在no_proxy环境变量中指定实例IP。

关于jenkins - 无法为Jenkins设置Kubernetes插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47084055/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com