我在AWS EKS中设置了一个jenkins服务器。它在 EC2 上的私有子网中运行,并以内部 ALB 为前端。 ALB 具有安全组,允许来自我组织的 VPN 以及我在此站点上找到的位桶白名单 IP 的流量 (https://support.atlassian.com/organization-administration/docs/ip-addresses-and-domains-for -atlassian-cloud-products/#AtlassiancloudIPrangesanddomains-OutgoingConnections)和(https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-使用配置我的公司防火墙/)。
当我单击“立即构建”时,我可以从我的 jenkins 实例运行构建。但是,当我尝试从 bitbucket 推送触发构建时,我收到“ERR_ACCESS_DENIED 0”错误。
--></style>
</head><body id=ERR_ACCESS_DENIED>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>
<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="https://jenkins-url/*">https://<jenkins-url>/*</a></p>
<blockquote id="error">
<p><b>Access Denied.</b></p>
</blockquote>
<p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p>
<p>Your cache administrator is <a href="mailto:webmaster">webmaster</a>.</p>
<br>
</div>
我验证的事情:
还有什么我需要在这里做的吗?我缺少什么,请指教?
据我了解,您
Jenkins
正在私有子网中运行,并且您正在通过内部ALB访问它。还提供了 Bitbucket
服务器 IP 的链接,告诉我您没有托管自己的 Bitbucket
服务器,因为这些是公共 IP,并在官方文档网站上列出。
在这种情况下,您将需要在公共子网中配置第二个负载均衡器,以便
Bitbucket
服务器将能够访问私有子网中的 Jenkins
。
官方配置示例
Jenkins
helm图表:
ingress:
enabled: true
apiVersion: "networking.k8s.io/v1"
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
hostName: jenkins.xyz.com
ingressClassName: internal-nginx
tls:
- secretName: tls-wildcard-xyz-com
hosts:
- jenkins.xyz.com
secondaryingress:
enabled: true
paths:
- /bitbucket-hook/
apiVersion: "networking.k8s.io/v1"
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
hostName: jenkins-webhook.xyz.com
ingressClassName: external-nginx
tls:
- secretName: tls-wildcard-xyz-com
hosts:
- jenkins-webhook.xyz.com
请记住,您无法从互联网访问私有子网中的资源。