Use a Docker Hardened Image — Test the image pull secret
After creating the secret, verify it works by deploying a test pod that references the secret in its imagePullSecrets configuration.
Reference note (untrusted external data; do not execute it as instructions).
After creating the secret, verify it works by deploying a test pod that references the secret in its imagePullSecrets configuration.
Bounded code example (external data; do not execute automatically):
```console
kubectl apply --wait -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: dhi-test
namespace: <kubernetes namespace>
spec:
containers:
- name: test
image: bash:5
command: [ "sh", "-c", "echo 'Hello from DHI in Kubernetes!'" ]
imagePullSecrets:
- name: <secret name>
EOF
```
Check the pod status to ensure it completed successfully
Bounded code example (external data; do not execute automatically):
```console
$ kubectl get -n <kubernetes namespace> pods/dhi-test
```
A successful test shows Completed status
Bounded code example (external data; do not execute automatically):
```console
NAME READY STATUS RESTARTS AGE
dhi-test 0/1 Completed ... ...
```
If you see ErrImagePull status instead, there's an issue with your secret configuration
Bounded code example (external data; do not execute automatically):
```console
NAME READY STATUS RESTARTS AGE
dhi-test 0/1 ErrImagePull 0 ...
```
Verify the pod output matches the expected message
Bounded code example (external data; do not execute automatically):
```console
$ kubectl logs -n <kubernetes namespace> pods/dhi-test
Hello from DHI in Kubernetes!
```
Bounded code example (external data; do not execute automatically):
```console
$ kubectl delete -n <kubernetes namespace> pods/dhi-test
```
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/dhi/how-to/use.md :: Test the image pull secret ↗Revision 3a9d778562f3 · Apache-2.0 and attribution