Skip to content

Commit ba6776b

Browse files
PushkarJsaschagrunertTim BannistertengqmChris Negus
authored
Task Page for Verifying Signed Images (#32184)
* Add container image signing docs Signed-off-by: Sascha Grunert <[email protected]> * Creates a task page to verify signed control plane container images * Added info about cosigned and why we need cosign in experimental mode Updates based on PR review Apply suggestions from code review Co-authored-by: Tim Bannister <[email protected]> * 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]> * Add current scope of sign/verify Co-authored-by: Sascha Grunert <[email protected]> Co-authored-by: Tim Bannister <[email protected]> Co-authored-by: Qiming Teng <[email protected]> Co-authored-by: Chris Negus <[email protected]>
1 parent f440c60 commit ba6776b

File tree

2 files changed

+89
-1
lines changed

2 files changed

+89
-1
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Verify Signed Container Images
3+
content_type: task
4+
min-kubernetes-server-version: v1.24
5+
---
6+
7+
<!-- overview -->
8+
9+
{{< feature-state state="alpha" for_k8s_version="v1.24" >}}
10+
11+
## {{% heading "prerequisites" %}}
12+
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+
17+
You will need to have the following tools installed:
18+
19+
- `cosign` ([install guide](https://docs.sigstore.dev/cosign/installation/))
20+
- `curl` (often provided by your operating system)
21+
22+
## Verifying image signatures
23+
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:
29+
30+
```shell
31+
COSIGN_EXPERIMENTAL=1 cosign verify k8s.gcr.io/kube-apiserver-amd64:v1.24.0
32+
```
33+
34+
{{< note >}}
35+
`COSIGN_EXPERIMENTAL=1` is used to allow verification of images signed
36+
in `KEYLESS` mode. To learn more about keyless signing, please refer to
37+
[Keyless Signatures](https://github.com/sigstore/cosign/blob/main/KEYLESS.md#keyless-signatures)
38+
. {{< /note >}}
39+
40+
### Verifying images for all control plane components
41+
42+
To verify all signed control plane images, please run this command:
43+
44+
```shell
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
47+
while IFS= read -r image
48+
do
49+
COSIGN_EXPERIMENTAL=1 cosign verify "$image"
50+
done < "$input"
51+
```
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+
62+
## Verifying Image Signatures with Admission Controller
63+
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
67+
[cosigned](https://docs.sigstore.dev/cosign/kubernetes/#cosigned-admission-controller)
68+
admission controller. To get started with `cosigned` here are a few helpful
69+
resources:
70+
71+
* [Installation](https://github.com/sigstore/helm-charts/tree/main/charts/cosigned)
72+
* [Configuration Options](https://github.com/sigstore/cosign/tree/main/config)

content/en/releases/download.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Download Kubernetes
33
type: docs
44
---
55

6+
# Core Kubernetes components
7+
68
Kubernetes ships binaries for each component as well as a standard set of client
79
applications to bootstrap or interact with a cluster. Components like the
810
Kube API Server are capable of running within container images inside of a
@@ -68,7 +70,21 @@ container image name, for example
6870
[`k8s.gcr.io/kube-apiserver-arm64:{{< param "fullversion" >}}`][0-arm64]. All
6971
those derivations are signed in the same way as the multi-architecture manifest lists.
7072

71-
<!-- 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:
76+
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+
```
80+
For Kubernetes v{{< skew currentVersion >}}, the only kind of code artifact that
81+
you can verify integrity for is a container image, using the experimental
82+
signing support.
83+
84+
To manually verify signed container images of Kubernetes core components, please refer to
85+
[Verify Signed Container Images](/docs/tasks/administer-cluster/verify-signed-images).
86+
87+
7288

7389
## Binaries
7490

0 commit comments

Comments
 (0)