-
Notifications
You must be signed in to change notification settings - Fork 14k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example of using secrets on windows
Based on https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#create-a-pod-that-has-access-to-the-secret-data-through-environment-variables TODO: figure out how to make the link https://k8s.io/docs/getting-started-guides/windows/secret-pod.yaml work - Used same secrets as standard instructions - Used environment variables to inject secrets - Updated windows/secret-pod.yaml to match new instructions - Because pod needs to keep running, add a ping -t localhost so that the pod is never "Completed". Linux uses nginx image, which has a default command. Signed-off-by: Ben Moss <bmoss@pivotal.io>
- Loading branch information
1 parent
a06ab65
commit 101d669
Showing
2 changed files
with
41 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,25 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: mysecret | ||
type: Opaque | ||
data: | ||
username: YWRtaW4= | ||
password: MWYyZDFlMmU2N2Rm | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: my-secret-pod | ||
name: secret-envars-test-pod | ||
spec: | ||
containers: | ||
- name: my-secret-pod | ||
image: microsoft/windowsservercore:1709 | ||
- name: envars-test-container | ||
image: microsoft/windowsservercore:latest | ||
imagePullPolicy: Never | ||
command: | ||
- ping | ||
- -t | ||
- localhost | ||
env: | ||
- name: USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysecret | ||
key: username | ||
- name: PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysecret | ||
key: password | ||
nodeSelector: | ||
beta.kubernetes.io/os: windows | ||
- name: SECRET_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: test-secret | ||
key: username | ||
- name: SECRET_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: test-secret | ||
key: password |