Skip to content

Commit cdfa952

Browse files
PushkarJtengqmChris Negus
committed
Uses K8s SBoM to get list of signed images
Apply suggestions from code review Co-authored-by: Qiming Teng <[email protected]> Co-authored-by: Chris Negus <[email protected]>
1 parent 306c786 commit cdfa952

File tree

6 files changed

+36
-111
lines changed

6 files changed

+36
-111
lines changed
Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Verify Signed Container Images
3-
content_type: task
3+
content_type: task
44
min-kubernetes-server-version: v1.24
55
---
66

@@ -10,50 +10,63 @@ min-kubernetes-server-version: v1.24
1010

1111
## {{% heading "prerequisites" %}}
1212

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.
1616

1717
You will need to have the following tools installed:
18+
1819
- `cosign` ([install guide](https://docs.sigstore.dev/cosign/installation/))
19-
- Go compiler ([install guide](https://go.dev/doc/install)
2020
- `curl` (often provided by your operating system)
2121

2222
## Verifying image signatures
23-
For a complete list of images that are signed please refer to [Releases](/releases/download/).
2423

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:
2729

2830
```shell
2931
COSIGN_EXPERIMENTAL=1 cosign verify k8s.gcr.io/kube-apiserver-amd64:v1.24.0
3032
```
3133

32-
{{% alert title="Note" %}}
34+
{{< note >}}
3335
`COSIGN_EXPERIMENTAL=1` is used to allow verification of images signed
3436
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 >}}
3739

3840
### Verifying images for all control plane components
3941

4042
To verify all signed control plane images, please run this command:
4143

4244
```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
4547
while IFS= read -r image
4648
do
4749
COSIGN_EXPERIMENTAL=1 cosign verify "$image"
4850
done < "$input"
4951
```
5052

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+
5162
## Verifying Image Signatures with Admission Controller
5263

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
5567
[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:
5770

5871
* [Installation](https://github.com/sigstore/helm-charts/tree/main/charts/cosigned)
5972
* [Configuration Options](https://github.com/sigstore/cosign/tree/main/config)

content/en/examples/admin/signed-images/auto-generated-list-of-all-signed-images.txt

Lines changed: 0 additions & 25 deletions
This file was deleted.

content/en/examples/admin/signed-images/generate-list-of-all-signed-images.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

content/en/examples/admin/signed-images/list-of-all-signed-images.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

content/en/examples/admin/signed-images/verify-all-signed-control-plane-images.go

Lines changed: 0 additions & 44 deletions
This file was deleted.

content/en/releases/download.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,16 @@ container image name, for example
7070
[`k8s.gcr.io/kube-apiserver-arm64:{{< param "fullversion" >}}`][0-arm64]. All
7171
those derivations are signed in the same way as the multi-architecture manifest lists.
7272

73-
<!-- TODO: describe how to use the signed images -->
73+
The Kubernetes project publishes a list of signed Kubernetes container images
74+
in SBoM (Software Bill of Materials) format.
75+
You can fetch that list using:
7476

75-
Full list of images that are signed can be found [here](/examples/admin/signed-images/auto-generated-list-of-all-signed-images.txt)
77+
```shell
78+
curl -Ls https://sbom.k8s.io/$(curl -Ls https://dl.k8s.io/release/latest.txt)/release | grep 'PackageName: k8s.gcr.io/' | awk '{print $2}'
79+
```
7680

7781
To manually verify signed container images of Kubernetes core components, please refer to
78-
[the corresponding cluster administration documentation](/docs/tasks/administer-cluster/verify-signed-images).
79-
Once verified, please use the same image digest of verified images to spin up your Kubernetes cluster.
82+
[Verify Signed Container Images](/docs/tasks/administer-cluster/verify-signed-images).
8083

8184
## Binaries
8285

0 commit comments

Comments
 (0)