Private images cannot be used in troubleshoot/preflight collectors
Preflight checks that use images don't work in these scenarios:
- when
proxyPublicImagesflag is specified - when the image used is private
- in airgapped installs (where all images are private). These images are also not included in airgap bundles.
Related: https://github.com/replicatedhq/troubleshoot/issues/247
Ran into this. I partially worked around it by setting the image using LocalImageName, but didn't have a way to set the image pull secret. It looks like that's been fixed in KOTS 1.19.0. Has this issue also been fixed for 1.19.0?
Yes, this is fixed in 1.19.0!
Really? I'll have to test it out, I didn't see anything patching the imageName or imagePullSecret.
Yeah, I think this is still an issue. Troubleshoot was updated so you can reference an imagePullSecret, but KOTS doesn't automatically pull from the local registry and configure an image pull secret if a local registry is configured.
@MikaelSmith We tested airgap with Preflight checks with Private images and it’s working as expected, here are some instructions. You need the latest version of kots 1.19.x.
Step 1: First you need to add the image to additionalImages in Application kots kind.
kind: Application
spec:
additionalImages:
- "registry.replicated.com/aj-kots-collie/busybox:1"
https://kots.io/vendor/operators/additional-images/
Step 2: Define the run collector with LocalImageName and LocalRegistryImagePullSecret in the collector and define the analyzer as usual, here is an example
kind: Preflight
metadata:
name: example-preflight-checks
spec:
collectors:
- run:
collectorName: "kotsadm-ping"
image: 'repl{{ LocalImageName "registry.replicated.com/aj-kots-collie/busybox:1" }}'
namespace: default
name: ping.txt
imagePullSecret:
name: aj-secret
data:
.dockerconfigjson: '{{repl LocalRegistryImagePullSecret }}'
type: kubernetes.io/dockerconfigjson
command: ["ping"]
args: ["-w", "10", "-c", "10", "-i", "0.3", "kotsadm"]
imagePullPolicy: IfNotPresent
analyzers:
- textAnalyze:
checkName: "kotsadm-ping"
fileName: ping.txt/kotsadm-ping.log
regexGroups: '(?PTransmitted\d+) packets? transmitted, (?PReceived\d+) packets? received, (?PLoss\d+)(\.\d+)?% packet loss'
outcomes:
- pass:
when: "Loss < 5"
message: Solid connection to kotsadm
- fail:
message: High packet loss
https://kots.io/vendor/operators/referencing-images/
Let me know if you guys have any questions.
Yes, that's what I'm doing. But it's not what I expected the outcome of this issue to be, I would have expected the preflight check not to need any modifications to work in an airgap environment.
Thanks for confirming. Consider this a workaround for now. I've created an internal ticket to exploring doing it automatically. (https://app.clubhouse.io/replicated/story/26487/automatically-adjust-private-image-references-in-preflight-and-support-bundles)