Deploying and verifying a new trial license key in Kubernetes

Swapnil Suryawanshi
Swapnil Suryawanshi

License Key Management in Kubernetes Environment

In a Kubernetes environment, a license key is always required for the operator to function. The only exception is when the operator is run with Community PostgreSQL. In this case, if the license key is unset, a cluster will start with a default trial license that automatically expires after 30 days.

Handling Expired License Keys

If your license key expires, usually due to the contract expiring, you will need to apply a new license key. There are two possible scenarios:

1. License Enabled for quay.io Images

If the license is enabled for quay.io images, you need to create a configmap as outlined here.

2. License Disabled for Cloudsmith Images

For Cloudsmith images, the license is disabled because you have already paid to pull images from Cloudsmith. The license key is not enforced, and no additional configuration is required. The operator will function correctly regardless of the configmap settings. In this case, you do not need to be concerned about the "not enforced" license status.

Verifying the Existing License

To verify the existing license, use the following command. In this example, the cluster name is cluster-example under the namespace postgresql-operator-system:

kubectl get cluster cluster-example -o yaml -n postgresql-operator-system | grep -A 3 licenseStatus

Sample Output:

licenseStatus:
  licenseExpiration: "2024-06-13T00:00:00Z"
  licenseStatus: Valid license (Testing)
  repositoryAccess: true
  valid: true
managedRolesStatus: {}

Applying a New License

If you have a new license key, follow these steps to update it:

Step 1: View Current Deployments

Use the following command to view current deployments:

kubectl get deployments -A

Sample Output:

NAMESPACE                    NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
postgresql-operator-system   postgresql-operator-controller-manager   1/1     1            1           51d

Step 2: Delete the Existing License

First, delete the existing license with the following command:

Syntax:

kubectl delete configmap [configmap_name] -n [NAMESPACE_NAME_HERE]

Sample Command:

kubectl delete configmap postgresql-operator-controller-manager-config -n postgresql-operator-system

Sample Output:

configmap "postgresql-operator-controller-manager-config" deleted

Step 3: Create a New Config Map with the New License Key

Syntax:

kubectl create configmap -n [NAMESPACE_NAME_HERE] \
    postgresql-operator-controller-manager-config \
    --from-literal=EDB_LICENSE_KEY=[LICENSE_KEY_HERE]

Sample Command:

kubectl create configmap postgresql-operator-controller-manager-config --from-literal=EDB_LICENSE_KEY=xxxxxxxxxxS2LBVXIYZSKZ4WI3KWPFGFQQTZMIZFCPJCFQRHAYLTON3W64TEEI5CEZCGJJDVOSCSN5MVKTTJKRXEE2TBIZRXUWLMM4YFURTLPJHVKMJVMFLWIyyyyyyyyyy -n postgresql-operator-system

Sample Output:

configmap/postgresql-operator-controller-manager-config created

Step 4: Restart the Deployment

Restart the deployment to apply the new license key:

kubectl rollout restart deployment -n [NAMESPACE_NAME_HERE] \
    postgresql-operator-controller-manager

Sample Command:

kubectl rollout restart deployment postgresql-operator-controller-manager -n postgresql-operator-system

Sample Output:

deployment.apps/postgresql-operator-controller-manager restarted

Step 5: Verify the New License

Finally, verify the new license with the following command:

kubectl get cluster cluster-example -o yaml -n postgresql-operator-system | grep -A 3 licenseStatus

Sample Output:

licenseStatus:
  licenseExpiration: "2024-07-13T00:00:00Z"
  licenseStatus: Valid license (Test-swap)
  repositoryAccess: true
  valid: true
managedRolesStatus: {}

Conclusion

Managing license keys in a Kubernetes environment is crucial for the seamless operation of the PostgreSQL operator. Always ensure that you have a valid license key, and be prepared to update it if it expires. The process involves verifying the existing license, deleting the expired license, creating a new config map with the new license key, and restarting the deployment. Following these steps will ensure that your operator continues to function correctly without any interruptions.

Was this article helpful?

0 out of 0 found this helpful