Running pods during collection time to create data
Deprecated as of v0.33.0. See the new Run Pod collector
run collector can be used to run a pod in the cluster with the parameters provided.
The collector will delete and clean up this pod and any artifacts after it's created.
This collector can be included multiple times, each defining different commands to run.
In addition to the shared collector properties, the
run collector accepts the following parameters:
The name of the collector. This will be prefixed to the path that the output is written to in the support bundle.
The namespace to look for the pod selector in. If not specified, it will assume the "current" namespace that the kubectl context is set to.
The image to run when starting the pod. This should be accessible to the nodes in the cluster.
An array of strings containing the command to use when starting the pod.
An array of strings containing the arguments to pass to the command when starting.
A duration that will be honored when running the pod. This cannot be greater than 30 seconds (30s) and if not specified, the default is 20s.
A service account to be used as the identity for processes running in the pod. If not specified, it will assume the "default" service account.
A valid, string representation of the policy to use when pulling the image. If not specified, this will be set to IfNotPresent.
imagePullSecretsupport was introduced in Kots 1.19.0 and Troubleshoot 0.9.42.
Troubleshoot offers two possibilities to use ImagePullSecrets, either using the name of a pre-existing secret in the cluster or dynamically creating a temporary secret to extract the image and destroy it after run-collector is done.
ImagePullSecret field accepts the following parameters:
If a pre-existing ImagePullSecret is used:
If an ImagePullSecret will be created for the run collector to pull the image:
A string indicating that the secret is of type "kubernetes.io/dockerconfigjson".
imagePullSecret: name: mysecret data: .dockerconfigjson: ewoJICJhdXRocyI6IHsKCQksHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEvIjoge30KCX0sCgkiSHR0cEhlYWRlcnMiOiB7CgkJIlVzZXItQWdlbnQiOiAiRG9ja2VyLUNsaWVudC8xOS4wMy4xMiAoZGFyd2luKSIKCX0sCgkiY3JlZHNTdG9yZSI6ICJkZXNrdG9wIiwKCSJleHBlcmltZW50YWwiOiAiZGlzYWJsZWQiLAoJInN0YWNrT3JjaGVzdHJhdG9yIjogInN3YXJtIgp9 type: kubernetes.io/dockerconfigjson
Further information about config.json file and dockerconfigjson secrets may be found here.
See the examples below for use cases.
apiVersion: troubleshoot.sh/v1beta2 kind: SupportBundle metadata: name: sample spec: collectors: - run: collectorName: "run-ping" image: busybox:1 namespace: default command: ["ping"] args: ["-w", "5", "www.google.com"] imagePullPolicy: IfNotPresent serviceAccountName: default
If a pull secret already exists in the cluster, you can use it by providing the run collector with the name of the secret.
spec: collectors: - run: collectorName: "myPrivateApp" image: my-private-repository/myRestApi namespace: default args: ["go", "run", "main.go"] imagePullSecret: name: mysecret
Troubleshoot will create a temporary secret, use it to pull the image from the private repository and delete it after the run collector is completed.
spec: collectors: - run: collectorName: "myPrivateApp" image: my-private-repository/myRestApi namespace: default args: ["go", "run", "main.go"] imagePullSecret: name: my-temporary-secret data: .dockerconfigjson: ewoJICJhdXRocyI6IHsKzCQksHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEvIjoge30KCX0sCgkiSHR0cEhlYWRlcnMiOiB7CgkJIlVzZXItQWdlbnQiOiAiRG9ja2VyLUNsaWVudC8xOS4wMy4xMiAoZGFyd2luKSIKCX0sCgkiY3JlZHNTdG9yZSI6ICJkZXNrdG9wIiwKCSJleHBlcmltZW50YWwiOiAiZGlzYWJsZWQiLAoJInN0YWNrT3JjaGVzdHJhdG9yIjogInN3YXJtIgp9 type: kubernetes.io/dockerconfigjson
When this collector is executed, it will include the following files in a support bundle:
This will contain the pod output (up to 10000 lines).