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
resource contains two maps: `data` and `stringData`.
22
22
The `data` field is used to store arbitrary data, encoded using base64. The
23
23
`stringData` field is provided for convenience, and it allows you to provide
24
-
Secret data as unencoded strings.
24
+
the same data as unencoded strings.
25
25
The keys of `data` and `stringData` must consist of alphanumeric characters,
26
26
`-`, `_` or `.`.
27
27
28
-
For example, to store two strings in a Secret using the `data` field, convert
29
-
the strings to base64 as follows:
28
+
The following example stores two strings in a Secret using the `data` field.
30
29
31
-
```shell
32
-
echo -n 'admin'| base64
33
-
```
30
+
1. Convert the strings to base64:
34
31
35
-
The output is similar to:
32
+
```shell
33
+
echo -n 'admin'| base64
34
+
echo -n '1f2d1e2e67df'| base64
35
+
```
36
36
37
-
```
38
-
YWRtaW4=
39
-
```
37
+
{{< note >}}
38
+
The serialized JSON and YAML values of Secret data are encoded as base64 strings. Newlines are not valid within these strings and must be omitted. When using the `base64` utility on Darwin/macOS, users should avoid using the `-b` option to split long lines. Conversely, Linux users *should* add the option `-w 0` to `base64` commands or the pipeline `base64 | tr -d '\n'` if the `-w` option is not available.
39
+
{{< /note >}}
40
40
41
-
```shell
42
-
echo -n '1f2d1e2e67df'| base64
43
-
```
41
+
The output is similar to:
44
42
45
-
The output is similar to:
43
+
```
44
+
YWRtaW4=
45
+
MWYyZDFlMmU2N2Rm
46
+
```
46
47
47
-
```
48
-
MWYyZDFlMmU2N2Rm
49
-
```
48
+
1. Create the manifest:
50
49
51
-
Write a Secret config file that looks like this:
50
+
```yaml
51
+
apiVersion: v1
52
+
kind: Secret
53
+
metadata:
54
+
name: mysecret
55
+
type: Opaque
56
+
data:
57
+
username: YWRtaW4=
58
+
password: MWYyZDFlMmU2N2Rm
59
+
```
52
60
53
-
```yaml
54
-
apiVersion: v1
55
-
kind: Secret
56
-
metadata:
57
-
name: mysecret
58
-
type: Opaque
59
-
data:
60
-
username: YWRtaW4=
61
-
password: MWYyZDFlMmU2N2Rm
62
-
```
61
+
Note that the name of a Secret object must be a valid
0 commit comments