1
1
---
2
2
title : Verify Signed Container Images
3
- content_type : task
3
+ content_type : task
4
4
min-kubernetes-server-version : v1.24
5
5
---
6
6
@@ -10,50 +10,63 @@ min-kubernetes-server-version: v1.24
10
10
11
11
## {{% heading "prerequisites" %}}
12
12
13
- These instructions are for Kubernetes {{< skew currentVersion >}}. If you want to check the
14
- integrity of components for a different version of Kubernetes, check the documentation for
15
- that Kubernetes release.
13
+ These instructions are for Kubernetes {{< skew currentVersion >}}. If you want
14
+ to check the integrity of components for a different version of Kubernetes,
15
+ check the documentation for that Kubernetes release.
16
16
17
17
You will need to have the following tools installed:
18
+
18
19
- ` cosign ` ([ install guide] ( https://docs.sigstore.dev/cosign/installation/ ) )
19
- - Go compiler ([ install guide] ( https://go.dev/doc/install )
20
20
- ` curl ` (often provided by your operating system)
21
21
22
22
## Verifying image signatures
23
- For a complete list of images that are signed please refer to [ Releases] ( /releases/download/ ) .
24
23
25
- Let's pick one image from this list and verify its signature
26
- using ` cosign verify ` command:
24
+ For a complete list of images that are signed please refer
25
+ to [ Releases] ( /releases/download/ ) .
26
+
27
+ Let's pick one image from this list and verify its signature using
28
+ the ` cosign verify ` command:
27
29
28
30
``` shell
29
31
COSIGN_EXPERIMENTAL=1 cosign verify k8s.gcr.io/kube-apiserver-amd64:v1.24.0
30
32
```
31
33
32
- {{% alert title="Note" % }}
34
+ {{< note > }}
33
35
` COSIGN_EXPERIMENTAL=1 ` is used to allow verification of images signed
34
36
in ` KEYLESS ` mode. To learn more about keyless signing, please refer to
35
- [ Keyless Signatures] ( https://github.com/sigstore/cosign/blob/main/KEYLESS.md#keyless-signatures ) .
36
- {{% /alert % }}
37
+ [ Keyless Signatures] ( https://github.com/sigstore/cosign/blob/main/KEYLESS.md#keyless-signatures )
38
+ . {{< /note > }}
37
39
38
40
### Verifying images for all control plane components
39
41
40
42
To verify all signed control plane images, please run this command:
41
43
42
44
``` shell
43
- curl https://kubernetes. io/examples/admin/signed-images/auto-generated-list-of-all-signed-images .txt --output auto-generated-list-of-all-signed- images.txt
44
- input=auto-generated-list-of-all-signed- images.txt
45
+ curl -Ls https://sbom.k8s. io/$( curl -Ls https://dl.k8s.io/release/latest .txt) /release | grep ' PackageName: k8s.gcr.io/ ' | awk ' {print $2} ' > images.txt
46
+ input=images.txt
45
47
while IFS= read -r image
46
48
do
47
49
COSIGN_EXPERIMENTAL=1 cosign verify " $image "
48
50
done < " $input "
49
51
```
50
52
53
+ Once you have verified an image, specify that image by its digest in your Pod
54
+ manifests as per this
55
+ example: ` registry-url/image-name@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 `
56
+ .
57
+
58
+ For more information, please refer
59
+ to [ Image Pull Policy] ( /docs/concepts/containers/images/#image-pull-policy )
60
+ section.
61
+
51
62
## Verifying Image Signatures with Admission Controller
52
63
53
- For non-control plane images (e.g. kube-conformance), image signatures can also
54
- be verified, at deploy time using
64
+ For non-control plane images (
65
+ e.g. [ conformance image] ( https://github.com/kubernetes/kubernetes/blob/master/test/conformance/image/README.md ) )
66
+ , signatures can also be verified at deploy time using
55
67
[ cosigned] ( https://docs.sigstore.dev/cosign/kubernetes/#cosigned-admission-controller )
56
- admission controller. To get started on ` cosigned ` here are a few helpful resources:
68
+ admission controller. To get started with ` cosigned ` here are a few helpful
69
+ resources:
57
70
58
71
* [ Installation] ( https://github.com/sigstore/helm-charts/tree/main/charts/cosigned )
59
72
* [ Configuration Options] ( https://github.com/sigstore/cosign/tree/main/config )
0 commit comments