Use the Secret and ConfigMaps
Page content
Use the Secret and ConfigMaps
$ cat my-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
stringData:
WSO2_CLOUD_ORG_KEY: "mycompany"
WSO2_CLOUD_EMAIL: "sample-email@wso2.com"
WSO2_CLOUD_PASSWORD: "password"
$ kubectl apply -f my-secret.yaml
secret/mysecret created
From Using Kubernetes Secrets as Environment Variables
spec:
containers:
-
env:
-
name: WSO2_CLOUD_ORG_KEY
valueFrom:
secretKeyRef:
name: mysecret
key: WSO2_CLOUD_ORG_KEY
...
apiVersion: v1
kind: Secret
metadata:
name: my-tokens
type: Opaque
stringData:
pinboard_key: "FIXME"
pocket_consumer_key: "FIXME"
pocket_access_token: "FIXME"
slack_api_token: "FIXME"
slack_events_token: "FIXME"
slack_verification_token: "FIXME"
slack_signing_secret: "FIXME"
telegram_token: "FIXME"
telegram_api_id: "FIXME"
telegram_api_hash: "FIXME"
$ kubectl apply -f my-tokens.yaml
secret/my-tokens created
$ kubectl get secrets
NAME TYPE DATA AGE
default-token-57nq8 kubernetes.io/service-account-token 3 395d
grafana Opaque 3 2d23h
grafana-test-token-88vrz kubernetes.io/service-account-token 3 2d23h
grafana-token-zc79r kubernetes.io/service-account-token 3 2d23h
influxdb-token-bjb5d kubernetes.io/service-account-token 3 4d12h
my-secret kubernetes.io/dockerconfigjson 1 269d
my-tokens Opaque 7 4s
sh.helm.release.v1.grafana.v1 helm.sh/release.v1 1 2d23h
sh.helm.release.v1.influxdb.v1 helm.sh/release.v1 1 4d12h
sh.helm.release.v1.podcast.v1 helm.sh/release.v1 1 4d13h
sh.helm.release.v1.sosa0sa.v1 helm.sh/release.v1 1 4d13h
$ kubectl get secrets my-tokens
NAME TYPE DATA AGE
my-tokens Opaque 7 7s
$ kubectl describe secret my-tokens
Name: my-tokens
Namespace: default
Labels: <none>
Annotations:
Type: Opaque
Data
====
pinboard_key: 30 bytes
slack_signing_secret: 32 bytes
telegram_api_id: 7 bytes
verification_token: 24 bytes
pocket_access_token: 30 bytes
pocket_consumer_key: 30 bytes
slack_api_token: 56 bytes
slack_events_token: 32 bytes
telegram_api_hash: 32 bytes
telegram_token: 46 bytes
#fun-for-life #kubernetes #TIL #publish