You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/registry.md
+47-26Lines changed: 47 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,17 @@
1
1
# Configure Image Registry
2
+
2
3
This document describes the method to configure the image registry for `containerd` for use with the `cri` plugin.
3
4
4
5
NOTE: The configuration syntax used in this doc is in version 2 which is the
5
6
recommended since `containerd` 1.3. If your configuration is still in version 1,
6
7
you can replace `"io.containerd.grpc.v1.cri"` with `cri`.
7
8
8
9
## Configure Registry Endpoint
10
+
9
11
With containerd, `docker.io` is the default image registry. You can also set up other image registries similar to docker.
10
12
11
13
To configure image registries create/modify the `/etc/containerd/config.toml` as follows:
14
+
12
15
```toml
13
16
# Config file is parsed as version 1 by default.
14
17
# To use the long form of plugin names set "version = 2"
@@ -35,6 +38,7 @@ that if the default registry endpoint is not already specified in the endpoint l
35
38
tried at the end with scheme `https` and path `v2`, e.g. `https://gcr.io/v2` for `gcr.io`.
36
39
37
40
As an example, for the image `gcr.io/library/busybox:latest`, the endpoints are:
41
+
38
42
*`gcr.io` is configured: endpoints for `gcr.io` + default endpoint `https://gcr.io/v2`.
39
43
*`*` is configured, and `gcr.io` is not: endpoints for `*` + default
@@ -43,9 +47,11 @@ As an example, for the image `gcr.io/library/busybox:latest`, the endpoints are:
43
47
After modify this config, you need restart the `containerd` service.
44
48
45
49
## Configure Registry TLS Communication
50
+
46
51
`cri` plugin also supports configuring TLS settings when communicating with a registry.
47
52
48
53
To configure the TLS settings for a specific registry, create/modify the `/etc/containerd/config.toml` as follows:
54
+
49
55
```toml
50
56
# explicitly use v2 config format
51
57
version = 2
@@ -58,7 +64,7 @@ version = 2
58
64
key_file = "key.pem"
59
65
```
60
66
61
-
In the config example shown above, TLS mutual authentication will be used for communications with the registry endpoint located at https://my.custom.registry.
67
+
In the config example shown above, TLS mutual authentication will be used for communications with the registry endpoint located at <https://my.custom.registry>.
62
68
`ca_file` is file name of the certificate authority (CA) certificate used to authenticate the x509 certificate/key pair specified by the files respectively pointed to by `cert_file` and `key_file`.
63
69
64
70
`cert_file` and `key_file` are not needed when TLS mutual authentication is unused.
@@ -86,6 +92,7 @@ version = 2
86
92
87
93
To configure a credential for a specific registry, create/modify the
88
94
`/etc/containerd/config.toml` as follows:
95
+
89
96
```toml
90
97
# explicitly use v2 config format
91
98
version = 2
@@ -98,40 +105,51 @@ version = 2
98
105
auth = ""
99
106
identitytoken = ""
100
107
```
108
+
101
109
The meaning of each field is the same with the corresponding field in `.docker/config.json`.
102
110
103
111
Please note that auth config passed by CRI takes precedence over this config.
104
112
The registry credential in this config will only be used when auth config is
105
113
not specified by Kubernetes via CRI.
106
114
107
-
After modify this config, you need restart the `containerd` service.
115
+
After modifying this config, you need to restart the `containerd` service.
108
116
109
-
### Configure Registry Credentials Example - GCR with _json_key Authentication
117
+
### Configure Registry Credentials Example - GCR with service account key authentication
110
118
111
-
Create a gcp account with gcr, do all the steps to enable receiving a
112
-
pushed image for a gcr instance, including the generation and download of a
113
-
new _json_key (for a new service account user.) To make sure your
114
-
gcr registry is working with _json_key authentication let's login and
115
-
push an image to your gcr instance: *This step is not necessary if you have
116
-
already pushed an image to your gcr instance.*
119
+
If you don't already have Google Container Registry (GCR) set-up then you need to do the following steps:
* Create a Google Cloud Platform (GCP) account and project if not already created (see [GCP getting started](https://cloud.google.com/gcp/getting-started))
122
+
* Enable GCR for your project (see [Quickstart for Container Registry](https://cloud.google.com/container-registry/docs/quickstart))
123
+
* For authentication to GCR: Create [service account and JSON key](https://cloud.google.com/container-registry/docs/advanced-authentication#json-key)
124
+
* The JSON key file needs to be downloaded to your system from the GCP console
125
+
* For access to the GCR storage: Add service account to the GCR storage bucket with storage admin access rights (see [Granting permissions](https://cloud.google.com/container-registry/docs/access-control#grant-bucket))
126
+
127
+
Refer to [Pushing and pulling images](https://cloud.google.com/container-registry/docs/pushing-and-pulling) for detailed information on the above steps.
123
128
124
-
Generate a single line for the _json_key file that you downloaded:
129
+
> Note: The JSON key file is a multi-line file and can be cumbersome to use its contents as a key outside of file. It is worthwhile generating a single line format output of the file. One way of doing this is using the `jq` tool as follows: `jq -c . key.json`
125
130
126
-
```bash
127
-
jq -c . key.json
131
+
It is beneficial to first confirm that from your terminal you can authenticate with your GCR and have access to the storage before hooking it into containerd. This can be verified by performing a login to your GCR and
0 commit comments