skaffold: skaffold returns x509 while using buildx script, while buildx works without skaffold
Expected behavior
skaffold dev with custom build script to build and push to secured private repo like docker buildx does independently of skaffold.
Actual behavior
- buildx cmd successfully pushes to secured private repo
- skaffold dev returns error: x509 certificate signed by unknown authority
Information
- Skaffold version: v1.34.0
- Operating system: macOS Big Sur 11.4
- Installed via: homebrew
- Contents of skaffold.yaml:
apiVersion: skaffold/v2beta25
kind: Config
build:
artifacts:
- image: skaffold-example
context: .
custom:
buildCommand: ./build.sh
deploy:
kubectl:
manifests:
- k8s-*
- Contents of build.sh:
#!/usr/bin/env bash
docker buildx build \
--platform linux/amd64 \
--tag $IMAGE \
--push \
$BUILD_CONTEXT
Steps to reproduce the behavior
- skaffold/examples/getting-started
skaffold dev --default-repo my-secured-private-repo
Additionally
- I’ve attempted the same with the skaffold/examples/custom-buildx and received the same results
- The cmd:
docker buildx build --platform linux/amd64 --tag my-secured-private-repo/skaffold-example --push .
successfully pushes to the private repo.
- skaffold dev without the custom build script also pushes to the repo successfully. Suspect it has something to do with how skaffold checks for certs with a custom build cmd.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (4 by maintainers)
It sounds like either your Harbor certificate chain is missing an intermediary certificate, or one the chain’s roots or intermediates is marked as untrusted. If missing, you need to add this certificate to your configured Harbor certificate list.
Skaffold (via Golang) should uses the OS certificate store for its trusted roots, as does openssl (I’m fairly certain), whereas I believe Chrome maintains its own set of trusted roots (but maybe also accepts the OS roots too?). So it may be that Chrome includes the missing intermediate certificate.
I believe you said you’re on a Mac? Safari uses the OS certificates and may help more easily diagnose the problem. Apparently
curl -vwill show certificate information.Skaffold should use the same mechanisms used by Docker — using credential helpers defined in
~/.docker/config.json— to authenticate to the registry.I’ve been using buildx to build multi-platform images for Skaffold’s support images for
skaffold debug, and haven’t had any problems like this.So I’m baffled as to why it would not work for the custom builder, but does for other builders. If you could please run with
-vdebugand redact any sensitive information, that would be helpful.Confirmed running with custom
buildxcmd works as expected, post certificate alteration.Thanks for all the help, esp since it wasn’t a skaffold issue at all. 🙏🏻
@ianbuilds does the cert chain as seen by Chrome match what you see when you run the openssl command? What does the chain look like when viewed from the browser (i.e. by clicking on the lock icon and viewing the cert that way)? It would be interesting to see what Chrome sees and trusts for the root cert.
I realize the Docker daemon normally returns the resulting image digest and so Skaffold doesn’t need to query the remote registry explicitly like we do with the custom builder. So I suspect you have an issue with your local certificate store — perhaps something to do with Let’s Encrypt’s root expiry?
Skaffold leverages both [GGCR](https://github.com/google/go-containerregistry] and Docker libraries for fetching digests from remote registries. I suspect that you would have the same problem with connecting via either a Go CLI program.
Try connecting using
opensslto your remote registry and see there is an error. Below I show connecting to gcr.io and to badssl.If that works, then try GGCR’s
crane:--insecure-registry flag:cmd:
skaffold dev --insecure-registry my-repo --default-repo my-repo -vdebug:This cmd is being run from an M1 iMac, btw. Not sure if that’s relevant anyhow.
This seems to be failing when skaffold is pulling the image to check the digest. https://github.com/GoogleContainerTools/skaffold/blob/af75d9e6ca558b4b9207c6ed0fab3016af7c68c9/pkg/skaffold/docker/remote.go#L54
did you use a self-signed certificate to setup the image registry? Can you try setting this registry as an insecure registry and retrying?