From 817fec61f51a41d75fb92703337fe26b67dd4487 Mon Sep 17 00:00:00 2001 From: kevencript Date: Fri, 17 Mar 2023 23:58:30 -0300 Subject: [PATCH] feat: :sparkles: Configs: Secrets Kubernetes Secrets are secure objects used to store sensitive data, such as passwords, API keys, or tokens, within a cluster. They help protect confidential information and reduce the risk of exposing it accidentally. Secrets store data in base64 encoding, ensuring an additional layer of obfuscation. They can be mounted as files, used as environment variables, or accessed by the Kubernetes API, providing a secure and controlled way to share sensitive information with containers. --- k8s/deployment.yaml | 4 +++- k8s/secret.yaml | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 k8s/secret.yaml diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index c1ce2ab..329f8fe 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -17,10 +17,12 @@ spec: spec: containers: - name: go-http-app - image: wesleywillians/hello-go:v5 # This image have the fields "NAME" & "AGE" & a file injection on myfamily/family.txt + image: wesleywillians/hello-go:v5.2 # This image have the fields "NAME" & "AGE" & a file injection on myfamily/family.txt envFrom: - configMapRef: name: go-http-app-env + - secretRef: + name: secret-app volumeMounts: - mountPath: "/go/myfamily" name: file-injection diff --git a/k8s/secret.yaml b/k8s/secret.yaml new file mode 100644 index 0000000..ec2bb93 --- /dev/null +++ b/k8s/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: secret-app +type: Opaque +data: + USER: Z2FicmllbAo= + PASSWORD: MTIzNDU2Nwo=