gpt4 book ai didi

kubernetes - 从kubernetes中的环境变量创建tls secret

转载 作者:行者123 更新时间:2023-12-02 11:59:55 25 4
gpt4 key购买 nike

有没有办法从环境变量而不是文件在Kubernetes中创建tls secret ?
例如

kubectl create secret tls secret-tls --cert $ENV1 --key $ENV2

最佳答案

是的你可以。运行帮助cmd。

$ kubectl create secret tls --help
Create a TLS secret from the given public/private key pair.

The public/private key pair must exist before hand. The public key certificate must be .PEM encoded and match the given
private key.

Examples:
# Create a new TLS secret named tls-secret with the given key pair:
kubectl create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key

Options:
--allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in
the template. Only applies to golang and jsonpath output formats.
--append-hash=false: Append a hash of the secret to its name.
--cert='': Path to PEM encoded public key certificate.
--dry-run=false: If true, only print the object that would be sent, without sending it.
--generator='secret-for-tls/v1': The name of the API generator to use.
--key='': Path to private key associated with given certificate.
-o, --output='': Output format. One of:
json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
--save-config=false: If true, the configuration of current object will be saved in its annotation. Otherwise, the
annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
--template='': Template string or path to template file to use when -o=go-template, -o=go-template-file. The
template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--validate=true: If true, use a schema to validate the input before sending it

Usage:
kubectl create secret tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run] [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).

If you want to use data from your environment, then set the cert andkey files path to env variables. Not the data themselves.

关于kubernetes - 从kubernetes中的环境变量创建tls secret ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63707178/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com