mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 03:03:59 +00:00
Merge pull request #8363 from caesarxuchao/secrets-doc
update docs/secrets.md to v1beta3
This commit is contained in:
commit
0b4eb95dad
208
docs/secrets.md
208
docs/secrets.md
@ -108,12 +108,14 @@ To create a pod that uses an ssh key stored as a secret, we first need to create
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta2",
|
|
||||||
"kind": "Secret",
|
"kind": "Secret",
|
||||||
"id": "ssh-key-secret",
|
"apiVersion": "v1beta3",
|
||||||
|
"metadata": {
|
||||||
|
"name": "ssh-key-secret"
|
||||||
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"id-rsa.pub": "dmFsdWUtMQ0K",
|
"id-rsa": "dmFsdWUtMg0KDQo=",
|
||||||
"id-rsa": "dmFsdWUtMg0KDQo="
|
"id-rsa.pub": "dmFsdWUtMQ0K"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -127,34 +129,36 @@ consumes it in a volume:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"id": "secret-test-pod",
|
|
||||||
"kind": "Pod",
|
"kind": "Pod",
|
||||||
"apiVersion":"v1beta2",
|
"apiVersion": "v1beta3",
|
||||||
"labels": {
|
"metadata": {
|
||||||
"name": "secret-test"
|
"name": "secret-test-pod",
|
||||||
|
"labels": {
|
||||||
|
"name": "secret-test"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"desiredState": {
|
"spec": {
|
||||||
"manifest": {
|
"volumes": [
|
||||||
"version": "v1beta1",
|
{
|
||||||
"id": "secret-test-pod",
|
"name": "secret-volume",
|
||||||
"containers": [{
|
"secret": {
|
||||||
|
"secretName": "ssh-key-secret"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
"name": "ssh-test-container",
|
"name": "ssh-test-container",
|
||||||
"image": "mySshImage",
|
"image": "mySshImage",
|
||||||
"volumeMounts": [{
|
"volumeMounts": [
|
||||||
"name": "secret-volume",
|
{
|
||||||
"mountPath": "/etc/secret-volume",
|
"name": "secret-volume",
|
||||||
"readOnly": true
|
"readOnly": true,
|
||||||
}]
|
"mountPath": "/etc/secret-volume"
|
||||||
}],
|
|
||||||
"volumes": [{
|
|
||||||
"name": "secret-volume",
|
|
||||||
"source": {
|
|
||||||
"secret": {
|
|
||||||
"secretName": "ssh-key-secret"
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}]
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -175,91 +179,109 @@ credentials.
|
|||||||
The secrets:
|
The secrets:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[{
|
|
||||||
"apiVersion": "v1beta2",
|
|
||||||
"kind": "Secret",
|
|
||||||
"id": "prod-db-secret",
|
|
||||||
"data": {
|
|
||||||
"username": "dmFsdWUtMQ0K",
|
|
||||||
"password": "dmFsdWUtMg0KDQo="
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta2",
|
"apiVersion": "v1beta3",
|
||||||
"kind": "Secret",
|
"kind": "List",
|
||||||
"id": "test-db-secret",
|
"items":
|
||||||
"data": {
|
[{
|
||||||
"username": "dmFsdWUtMQ0K",
|
"kind": "Secret",
|
||||||
"password": "dmFsdWUtMg0KDQo="
|
"apiVersion": "v1beta3",
|
||||||
}
|
"metadata": {
|
||||||
}]
|
"name": "prod-db-secret"
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"password": "dmFsdWUtMg0KDQo=",
|
||||||
|
"username": "dmFsdWUtMQ0K"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "Secret",
|
||||||
|
"apiVersion": "v1beta3",
|
||||||
|
"metadata": {
|
||||||
|
"name": "test-db-secret"
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"password": "dmFsdWUtMg0KDQo=",
|
||||||
|
"username": "dmFsdWUtMQ0K"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The pods:
|
The pods:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[{
|
{
|
||||||
"id": "prod-db-client-pod",
|
"apiVersion": "v1beta3",
|
||||||
"kind": "Pod",
|
"kind": "List",
|
||||||
"apiVersion":"v1beta2",
|
"items":
|
||||||
"labels": {
|
[{
|
||||||
"name": "prod-db-client"
|
"kind": "Pod",
|
||||||
},
|
"apiVersion": "v1beta3",
|
||||||
"desiredState": {
|
"metadata": {
|
||||||
"manifest": {
|
"name": "prod-db-client-pod",
|
||||||
"version": "v1beta1",
|
"labels": {
|
||||||
"id": "prod-db-pod",
|
"name": "prod-db-client"
|
||||||
"containers": [{
|
}
|
||||||
"name": "db-client-container",
|
},
|
||||||
"image": "myClientImage",
|
"spec": {
|
||||||
"volumeMounts": [{
|
"volumes": [
|
||||||
|
{
|
||||||
"name": "secret-volume",
|
"name": "secret-volume",
|
||||||
"mountPath": "/etc/secret-volume",
|
|
||||||
"readOnly": true
|
|
||||||
}]
|
|
||||||
}],
|
|
||||||
"volumes": [{
|
|
||||||
"name": "secret-volume",
|
|
||||||
"source": {
|
|
||||||
"secret": {
|
"secret": {
|
||||||
"secretName": "prod-db-secret"
|
"secretName": "prod-db-secret"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
],
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "db-client-container",
|
||||||
|
"image": "myClientImage",
|
||||||
|
"volumeMounts": [
|
||||||
|
{
|
||||||
|
"name": "secret-volume",
|
||||||
|
"readOnly": true,
|
||||||
|
"mountPath": "/etc/secret-volume"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "test-db-client-pod",
|
|
||||||
"kind": "Pod",
|
|
||||||
"apiVersion":"v1beta2",
|
|
||||||
"labels": {
|
|
||||||
"name": "test-db-client"
|
|
||||||
},
|
},
|
||||||
"desiredState": {
|
{
|
||||||
"manifest": {
|
"kind": "Pod",
|
||||||
"version": "v1beta1",
|
"apiVersion": "v1beta3",
|
||||||
"id": "test-db-pod",
|
"metadata": {
|
||||||
"containers": [{
|
"name": "test-db-client-pod",
|
||||||
"name": "db-client-container",
|
"labels": {
|
||||||
"image": "myClientImage",
|
"name": "test-db-client"
|
||||||
"volumeMounts": [{
|
}
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"volumes": [
|
||||||
|
{
|
||||||
"name": "secret-volume",
|
"name": "secret-volume",
|
||||||
"mountPath": "/etc/secret-volume",
|
|
||||||
"readOnly": true
|
|
||||||
}]
|
|
||||||
}],
|
|
||||||
"volumes": [{
|
|
||||||
"name": "secret-volume",
|
|
||||||
"source": {
|
|
||||||
"secret": {
|
"secret": {
|
||||||
"secretName": "test-db-secret"
|
"secretName": "test-db-secret"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
],
|
||||||
|
"containers": [
|
||||||
|
{
|
||||||
|
"name": "db-client-container",
|
||||||
|
"image": "myClientImage",
|
||||||
|
"volumeMounts": [
|
||||||
|
{
|
||||||
|
"name": "secret-volume",
|
||||||
|
"readOnly": true,
|
||||||
|
"mountPath": "/etc/secret-volume"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}]
|
||||||
}]
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Both containers will have the following files present on their filesystems:
|
Both containers will have the following files present on their filesystems:
|
||||||
|
Loading…
Reference in New Issue
Block a user