command below gives an error: error: flag key is required
kubectl create secret tls k8-secret2 \
-n ingress-tls-test1 \
--cert ingress-tls-test1.pfx
I am able to create the secret using .crt and .key file:
kubectl create secret tls aks-ingress-tls \
--namespace ingress-basic \
--key aks-ingress-tls.key \
--cert aks-ingress-tls.crt
While creating k8s( up to
v1.19) secret oftype: kubernetes.io/tls, you must provide two keys;tls.keyandtls.crt. If you usekubectlto create a secret, you can use--certand--keyflags to provide the values of those keys.The public key certificate for
--certmust be .PEM encoded (Base64-encoded DER format), and match the given private key for--key.Since the
.pfxcertificate uses different encoding and stores all into a single encryptable file, you don't have separate certs and keys files to fulfil the requirements.But you can create a secret of the type Opaque instead of TLS.