Updating Dev Internal Certificates: Tips and Tricks to Simplify and Automate the Process


I am looking for some guidance on how to update the Dev Internal Certificates that I receive from our IT Team every 3 months. The mail contains cert.pem, priveykey.pem and a jks file. I know how to use kubectl to create a secret with the key and the certificate, but I am not sure about the other steps that involve renaming, copying, and creating files. What is the purpose of these steps and how do they relate to Certificate Chaining? Is there a way to automate this process or simplify it? What is the role of the jks file in this scenario? I would appreciate any resources or references that can help me learn more about this topic. Thank you for your time and expertise.


Updating Dev Internal Certificates: A Guide

If you are working on a web application that uses HTTPS for secure communication, you may need to update your Dev Internal Certificates every 3 months. These certificates are issued by your IT Team and sent to you via email. The email contains three files: cert.pem, priveykey.pem and a jks file. In this article, we will explain what these files are, how they are used, and how to update them using kubectl and other tools.

What are cert.pem and priveykey.pem?

The cert.pem file is a certificate file that contains your public key and some information about your identity, such as your domain name, organization name, and location. The certificate is signed by a Certificate Authority (CA), which is a trusted entity that verifies your identity and vouches for your public key. The CA also provides its own certificate, which is called an intermediate certificate, and links your certificate to a root certificate, which is the ultimate source of trust in the certificate chain.

The priveykey.pem file is a private key file that contains your secret key, which is mathematically related to your public key. The private key is used to decrypt data that is encrypted with your public key, or to sign data that can be verified with your public key. The private key must be kept secret and protected from unauthorized access.

What is a jks file?

The jks file is a Java KeyStore file that stores your certificate and private key in a binary format. The file is encrypted and password-protected, so you need to provide the password to access its contents. The jks file is used by Java applications that need to use your certificate and private key for HTTPS communication. For example, if you are developing a web service using Java, you may need to configure your application server to use the jks file as the keystore for SSL/TLS.

How to update the certificates using kubectl?

One of the steps to update your certificates is to use kubectl, which is a command-line tool that allows you to interact with Kubernetes, a platform for managing containerized applications. Kubernetes uses secrets, which are objects that store sensitive data such as passwords, tokens, or keys. You can create a secret with your certificate and private key using the following command:


kubectl create secret tls dev-tls –key=priveykey.pem –cert=cert.pem –dry-run=client -o yaml | kubectl apply -f –


This command creates a secret named dev-tls with your key and certificate, and outputs it in YAML format. The `–dry-run=client` option prevents the secret from being created on the server, and the `-o yaml` option specifies the output format. The output is then piped to another kubectl command, which applies the secret to your cluster. This way, you can replace the existing secret without deleting it.

You can then use the secret in your pod or service configuration, by specifying the secret name and the key and certificate names. For example, you can use the following snippet to configure a pod that uses the secret for HTTPS communication:


apiVersion: v1

kind: Pod


name: my-pod



  • name: my-container
  • image: my-image ports:

  • containerPort: 443
  • protocol: TCP volumes:

  • name: tls-secret
  • secret: secretName: dev-tls volumeMounts:

  • name: tls-secret
  • mountPath: /etc/tls readOnly: true “`

    This snippet defines a pod named my-pod, which contains a container named my-container, which runs an image named my-image. The container exposes port 443 for HTTPS communication. The pod also defines a volume named tls-secret, which mounts the secret dev-tls to the path /etc/tls. The volume is read-only, to prevent accidental modification of the secret. The container can then access the key and certificate files at /etc/tls/priveykey.pem and /etc/tls/cert.pem, respectively.

    How to perform the other steps?

    The other steps that involve renaming, copying, and creating files are necessary to prepare your certificate and key files for different purposes. For example, you may need to rename cert.pem to cert.crt, because some applications expect the certificate file to have a .crt extension. You may also need to copy the intermediate and root certificates from the CA, and append them to your certificate file, to create a full chain of trust. This is called certificate chaining, and it allows the receiver of your certificate to verify its validity by following the chain up to the root certificate. You may also need to export your certificate and key files in different formats, such as PKCS12 or PEM, to use them with other tools or platforms.

    To perform these steps, you can use various tools, such as OpenSSL, Keytool, or KeyStore Explorer. These tools allow you to manipulate and convert your certificate and key files, as well as inspect their contents and properties. For example, you can use the following OpenSSL commands to rename cert.pem to cert.crt, and to create a full chain certificate file named main.crt:


    cp cert.pem cert.crt

    cat cert.crt inter.crt root.crt > main.crt


    These commands copy cert.pem to cert.crt, and concatenate cert.crt, inter.crt, and root.crt into main.crt. The inter.crt and root.crt files are the intermediate and root certificates from the CA, respectively.

    You can use the following Keytool command to import your certificate and key files into a jks file named clientkeystore:


    keytool -importkeystore -srckeystore cert.p12 -srcstoretype pkcs12 -destkeystore clientkeystore -deststoretype jks


    This command imports the contents of cert.p12, which is a PKCS12 file that contains your certificate and key files, into clientkeystore, which is a JKS file. You need to provide the passwords for both files when prompted.

    You can use KeyStore Explorer, which is a graphical tool, to open and view your jks file, as well as perform other operations, such as exporting, importing, or deleting entries. You can download KeyStore Explorer from [here].

    Resources and references

    To learn more about certificates, keys, and keystores, you can refer to the following resources:

  • [What is the SSL Certificate Chain?] – A guide that explains the concept and purpose of certificate chaining.
  • [How to create a self-signed certificate for a domain name for development on Windows 10 and below?] – A question and answer that shows how to create a self-signed certificate using PowerShell or IIS Manager.
  • [How to Create Trusted SSL Certificates for Your Local Development] – An article that demonstrates how to create and trust your own CA and certificates using OpenSSL.
  • [How do you install a dev certificate in a windows docker container and windows host?] – A question and answer that discusses how to use the dotnet dev-certs command to generate and install a developer certificate for HTTPS development.
  • [Difference between .keystore file and .jks file] – A question and answer that clarifies the difference between the .keystore and .jks file extensions and formats.
  • [Creating a KeyStore in JKS Format] – A guide that explains how to create a keystore using the JKS format and the Keytool utility.
  • [JKS File – What is a .jks file and how do I open it?] – A page that describes the JKS file format and the tools that can open it.
  • Conclusion


this article, we have covered the basics of updating your Dev Internal Certificates, which are files that contain your cryptographic keys and certificates for HTTPS communication. We have explained what the files are, how they are used, and how to update them using kubectl and other tools. We have also introduced the concept of certificate chaining, and how it relates to the trustworthiness of your certificates. We have provided some resources and references for further learning and exploration. We hope this article has been helpful and informative for you. Thank you for your time and expertise..

Leave a Reply

Your email address will not be published. Required fields are marked *

Privacy Terms Contacts About Us