I have a TLS Secret. And it looks like the following one...
apiVersion: v1
kind: Secret
metadata:
name: tls-ingress-secret
namespace: ingress-namespace
type: kubernetes.io/tls
data:
tls.key: |
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCtwUrZ6zS GdAw
ldIUxIXpnajvAZun1mf8DD0nWJRBonzbBIZhLyHqQyPvz4B ZfZ/ql/vucpLEPnq
V3HqJraydt7kw/MBCS6a8GRObFx/faIWolbF5FjVgJexAxydeE35A7 hJUdElA7e
jOVPzafz53oJvyCdtdRTVwbH6EA aJGZ0eTmzRobLVdqmqCejN4soDeRZQcMXYrG
uW rTy3dyRCbMGV33GzYYJk2qBNFz DqZbp1TyFcOQKBgQDW3IvXES4hfgtmj8NK
0BKdX7gUyANdZooJ1tXoMjVmcFbdvoUprED3hpiI1WTYiZ3dqKD7QrHGsBW/yHZB
UfFFxSj vKotgxBhe06o2SDkXCnWfuQSJDZEgL/TuI9Qb/w1QeDxTZG4KCPiBrPD
MiXRtvV7qdyWoPjUolWfWyef4K5NVo34TF4DHseY1QMoI8dTmB0nnZiDfZA6B t0
jgrnP8RpqaAOH8UjRwC QMCfuq0SejUWocSobc/7K 7HJlMRwi6FuPXb7omyut 5
34pCkfAj8Lwtleweh/PbSDnX9g==
-----END PRIVATE KEY-----
tls.crt: |
-----BEGIN CERTIFICATE-----
MIIEDDCCAvSgAwIBAgIUDr8pM7eB UPyMD0sY0yR5XmWrVQwDQYJKoZIhvcNAQEL
BQAwgY8xCzAJBgNVBAYTAlJVMQ8wDQYDVQQIDAZSdXNzaWExDzANBgNVBAcMBk1v
c2NvdzEmMCQGA1UECgwdS2lyaWxsIEtsaW11c2hpbnMgQ29ycG9yYXRpb24xHDAa
BgNVBAsME09yZ2FuaXphdGlvbmFsIFVuaXQxGDAWBgNVBAMMD3d3dy5zdG9yZXJ1
LmNvbTAeFw0yMjA3MjgxMTAyMThaFw0yMzA1MjQxMTAyMThaMIGPMQswCQYDVQQG
PkBW2sS7dMxNLLeHyZ3st1SJfmWZhya1LsPvo1ilU3 d8rD5JjlC/cQ7EAF9DDXR
i3/9zNzx3R6MMgNqkzQ89dDjHH FZ2R0VkBKp35MYVg=
-----END CERTIFICATE-----
So the question is "is it possible to retrieve it as an env vars like: "tls.cert" and "tls.key", so I would be able to access it in my application...
What I want to receive from that is...
SSlCertFile := os.Getenv("tls.cert") // cert file with payload.
SslCertKey := os.Getenv("tls.key") // cert file key.
CodePudding user response:
Example:
apiVersion: v1
kind: Pod
metadata:
name: busybox
spec:
containers:
- name: busybox
image: busybox
commands: ["ash","-c","sleep 3600"]
envFrom:
- secretRef:
name: tls-ingress-secret
After you create the pod, try kubectl exec -it busybox -- env