Switch registry hostname to Contour ingress (harbor.192.168.1.7.nip.io)
demo-go-app's Deployment failed to pull: "dial tcp: lookup harbor-core.harbor.svc.cluster.local on 127.0.0.53:53: server misbehaving". docker push worked from the Jenkins build pod because it has pod-network DNS (CoreDNS); pulling for a real Deployment happens via containerd on the node itself, using the node's host-level resolver, which has no route to *.svc.cluster.local at all. Switches buildDocker.groovy's push target and dind-pod.yaml's --insecure-registry flag to the Contour ingress hostname instead, which resolves via normal public DNS (nip.io) from both pods and the host.
This commit is contained in:
@@ -15,16 +15,17 @@ spec:
|
|||||||
image: docker:27-dind
|
image: docker:27-dind
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
# Harbor's harbor-core Service serves plain HTTP internally (TLS is
|
# Harbor's ingress serves plain HTTP too (TLS disabled cluster-wide
|
||||||
# disabled cluster-wide by design — see claude.md's "everything is
|
# by design — see claude.md's "everything is plain HTTP" note).
|
||||||
# plain HTTP" note). Docker still defaults to attempting HTTPS
|
# Docker defaults to attempting HTTPS against any bare registry
|
||||||
# against any bare registry hostname regardless of whether the
|
# hostname regardless of network path, so this is needed
|
||||||
# network path actually involves TLS anywhere — that default isn't
|
# regardless of which hostname is used — was previously
|
||||||
# about routing through Contour/Ingress, it's just the client's own
|
# harbor-core.harbor.svc.cluster.local (cluster-internal Service
|
||||||
# convention. Without this flag, `docker push` hangs doing a TLS
|
# DNS, works from this pod but not from the node's own containerd
|
||||||
# handshake against a server that's only ever spoken HTTP.
|
# when pulling for a real Deployment); switched to the Contour
|
||||||
|
# ingress hostname so push and pull can share one reference.
|
||||||
args:
|
args:
|
||||||
- "--insecure-registry=harbor-core.harbor.svc.cluster.local"
|
- "--insecure-registry=harbor.192.168.1.7.nip.io"
|
||||||
env:
|
env:
|
||||||
- name: DOCKER_TLS_CERTDIR
|
- name: DOCKER_TLS_CERTDIR
|
||||||
value: ""
|
value: ""
|
||||||
|
|||||||
@@ -20,7 +20,15 @@ import com.homelab.utilities.constructTemplate
|
|||||||
def run(Map config) {
|
def run(Map config) {
|
||||||
def tag = "${env.BUILD_NUMBER}-${env.GIT_COMMIT?.take(7) ?: 'dev'}"
|
def tag = "${env.BUILD_NUMBER}-${env.GIT_COMMIT?.take(7) ?: 'dev'}"
|
||||||
env.TAG = tag
|
env.TAG = tag
|
||||||
def image = "harbor-core.harbor.svc.cluster.local/${config.harbor_project}/${config.repo_name}:${tag}"
|
// Was harbor-core.harbor.svc.cluster.local (cluster-internal Service
|
||||||
|
// DNS) — worked for this push, since it runs inside a pod with
|
||||||
|
// pod-network DNS (CoreDNS). But the actual Deployment's image PULL
|
||||||
|
// happens via containerd running on the node itself, using the
|
||||||
|
// node's host-level DNS resolver, which has no route to
|
||||||
|
// *.svc.cluster.local at all. Using the Contour ingress hostname
|
||||||
|
// instead makes the same reference resolvable from both contexts
|
||||||
|
// (nip.io resolves via normal public DNS, reachable from the host).
|
||||||
|
def image = "harbor.192.168.1.7.nip.io/${config.harbor_project}/${config.repo_name}:${tag}"
|
||||||
try {
|
try {
|
||||||
stage(stageName('Build & push image')) {
|
stage(stageName('Build & push image')) {
|
||||||
container('docker-cli') {
|
container('docker-cli') {
|
||||||
|
|||||||
Reference in New Issue
Block a user