-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Spin using Secrets in Kubernetes | ||
|
||
## Scenario | ||
|
||
This scenario will demonstrate how to inject a Kubernetes secret into a Spin Application. | ||
|
||
## Usage | ||
|
||
Create a secret | ||
|
||
``` | ||
$ kubectl create secret generic spin-password --from-literal="password=super-secret" | ||
``` | ||
|
||
Deploy the Spin application: | ||
|
||
``` | ||
$ kubectl apply -f deploy_spin-secret.yaml | ||
``` | ||
|
||
Access the Spin application: | ||
|
||
``` | ||
$ kubectl port-forward deployment/spin-secret 8000:80 | ||
``` | ||
|
||
And access `localhost:8000` in your browser. |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: spin-secret | ||
name: spin-secret | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: spin-secret | ||
template: | ||
metadata: | ||
labels: | ||
app: spin-secret | ||
spec: | ||
runtimeClassName: wasmtime-spin | ||
containers: | ||
- image: ghcr.io/liquid-reply/k8s-spin/spin-redis:latest | ||
name: spin-env-explorer | ||
command: ["/"] | ||
env: | ||
- name: SPIN_VARIABLE_CONFIG_VALUE | ||
valueFrom: | ||
secretKeyRef: | ||
name: spin-password | ||
key: password | ||
resources: | ||
limits: | ||
cpu: 100m | ||
memory: 100Mi | ||
requests: | ||
cpu: 100m | ||
memory: 100Mi | ||
volumes: | ||
- name: spin-password | ||
secret: | ||
secretName: spin-password |