<p>command below gives an error: <code>error: flag key is required</code></p>
<pre><code>kubectl create secret tls k8-secret2 \
    -n ingress-tls-test1 \
    --cert ingress-tls-test1.pfx
</code></pre>
<p>I am able to create the secret using .crt and .key file:</p>
<pre><code>kubectl create secret tls aks-ingress-tls \
    --namespace ingress-basic \
    --key aks-ingress-tls.key \
    --cert aks-ingress-tls.crt
</code></pre>

<p>I needed to create a kube tls secret from .pfx file today
Credits to: <a href="https://adolfi.dev/blog/tls-kubernetes/" rel="noreferrer">https://adolfi.dev/blog/tls-kubernetes/</a></p>
<pre class="lang-bash prettyprint-override"><code>## you will enter the pfx PW on on the CMD/terminal
openssl pkcs12 -in pfx-filename.pfx -nocerts -out key-filename.key
openssl rsa -in key-filename.key -out key-filename-decrypted.key
openssl pkcs12 -in pfx-filename.pfx -clcerts -nokeys -out crt-filename.crt  ##remove clcerts to get the full chain in your cert
kubectl create secret tls your-secret-name --cert crt-filename.crt --key key-filename-decrypted.key
</code></pre>
