@@ -108,22 +108,7 @@ stringData:
108
108
When you retrieve the Secret data, the command returns the encoded values,
109
109
and not the plaintext values you provided in ` stringData`.
110
110
111
- Create the Secret using [`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands#apply):
112
-
113
- ` ` ` shell
114
- kubectl apply -f ./secret.yaml
115
- ` ` `
116
-
117
- The output is similar to :
118
-
119
- ` ` `
120
- secret/mysecret created
121
- ` ` `
122
-
123
- # # Check the Secret
124
-
125
- The `stringData` field is a write-only convenience field. It is never output when
126
- retrieving Secrets. For example, if you run the following command :
111
+ For example, if you run the following command :
127
112
128
113
` ` ` shell
129
114
kubectl get secret mysecret -o yaml
@@ -145,14 +130,9 @@ metadata:
145
130
type: Opaque
146
131
` ` `
147
132
148
- The commands `kubectl get` and `kubectl describe` avoid showing the contents of a `Secret` by
149
- default. This is to protect the `Secret` from being exposed accidentally to an onlooker,
150
- or from being stored in a terminal log.
151
- To check the actual content of the encoded data, please refer to
152
- [decoding secret](/docs/tasks/configmap-secret/managing-secret-using-kubectl/#decoding-secret).
133
+ # ## Specifying both `data` and `stringData`
153
134
154
- If a field, such as `username`, is specified in both `data` and `stringData`,
155
- the value from `stringData` is used. For example, the following Secret definition :
135
+ If you specify a field in both `data` and `stringData`, the value from `stringData` is used. For example, if you define the following Secret :
156
136
157
137
` ` ` yaml
158
138
apiVersion: v1
@@ -166,7 +146,7 @@ stringData:
166
146
username: administrator
167
147
` ` `
168
148
169
- Results in the following Secret :
149
+ The `Secret` object is created as follows :
170
150
171
151
` ` ` yaml
172
152
apiVersion: v1
@@ -182,7 +162,7 @@ metadata:
182
162
type: Opaque
183
163
` ` `
184
164
185
- Where `YWRtaW5pc3RyYXRvcg==` decodes to `administrator`.
165
+ ` YWRtaW5pc3RyYXRvcg==` decodes to `administrator`.
186
166
187
167
# # Clean Up
188
168
0 commit comments