|
| 1 | += Temporary credentials lifetime |
| 2 | +:description: Customize the lifetime of temporary credentials. |
| 3 | + |
| 4 | +== Usages |
| 5 | + |
| 6 | +=== TLS certificates |
| 7 | + |
| 8 | +Currently the only temporary credentials are TLS certificates. |
| 9 | + |
| 10 | +Many products use TLS to secure the communications, often times customers use the xref:secret-operator:secretclass.adoc#backend-autotls[secret-operator autoTls] backend to create TLS certificates for the Pods on the fly. |
| 11 | +To increase security, these temporary credentials have a short lifetime by default, which will result in e.g. Trino coordinator Pods restarting every ~24 hours (minus some safety buffer) to avoid using expired certificates. |
| 12 | + |
| 13 | +== Configure the lifetime |
| 14 | + |
| 15 | +In high load production environments, restarting Pods can be a costly operation, as it can disrupt services and in some cases even lead to data loss. |
| 16 | +To avoid frequent restarts, the lifetime of all temporary credentials (such as the TLS certificates) can be increased as needed. |
| 17 | + |
| 18 | +Here is an example for configuring the temporary credentials lifetime to 7 days in a HDFS stacklet. |
| 19 | +It should result in the HDFS Pods restarting weekly instead of daily: |
| 20 | + |
| 21 | +[source,yaml] |
| 22 | +---- |
| 23 | +--- |
| 24 | +apiVersion: hdfs.stackable.tech/v1alpha1 |
| 25 | +kind: HdfsCluster |
| 26 | +metadata: |
| 27 | + name: hdfs |
| 28 | +spec: |
| 29 | + nameNodes: |
| 30 | + config: |
| 31 | + requestedSecretLifetime: 7d # <1> |
| 32 | + roleGroups: |
| 33 | + default: |
| 34 | + replicas: 2 |
| 35 | + dataNodes: |
| 36 | + config: |
| 37 | + requestedSecretLifetime: 7d # <2> |
| 38 | + roleGroups: |
| 39 | + default: |
| 40 | + replicas: 2 |
| 41 | + journalNodes: |
| 42 | + roleGroups: |
| 43 | + default: |
| 44 | + replicas: 3 |
| 45 | + config: |
| 46 | + requestedSecretLifetime: 7d # <3> |
| 47 | +---- |
| 48 | +<1> The lifetime of the TLS certificates for *all* NameNode roleGroups is set to 7 days. |
| 49 | +<2> The lifetime of the TLS certificates for *all* DataNode roleGroups is set to 7 days. |
| 50 | +<3> The lifetime of the TLS certificates for the `default` JournalNode group is set to 7 days. |
| 51 | + |
| 52 | +NOTE: The configuration for the JournalNodes is done at roleGroup level for demonstration purposes. |
| 53 | + |
| 54 | +=== TLS certificate lifetimes |
| 55 | + |
| 56 | +Even though operators allow setting this property to a value of your choice, the xref:secret-operator:index.adoc[secret-operator] will not exceed the `maxCertificateLifetime` value specified in SecretClass creating the TLS certificates (see xref:secret-operator/secretclass.adoc#certificate_lifetime). |
| 57 | + |
| 58 | +=== Operator support |
| 59 | + |
| 60 | +Similar to the example above, users can configure the lifetime of temporary credentials for the following operators: |
| 61 | + |
| 62 | +* Apache Druid |
| 63 | +* Apache Hadoop |
| 64 | +* Apache HBase |
| 65 | +* Apache NiFi |
| 66 | +* Apache Spark |
| 67 | +* Apache Zookeeper |
| 68 | +* Trino |
| 69 | + |
| 70 | +== Pod lifetime annotations |
| 71 | + |
| 72 | +After configuring the lifetime as described above you could simply observe your stacklet for a week/month (or whatever your new lifetime is), to see if your changes take effect. |
| 73 | +However, it's much quicker to check at what point of time your Pods will be restarted next. |
| 74 | + |
| 75 | +Pods are not restarted "randomly" by Stackable operators, but in a predicable manner. |
| 76 | +When a temporary credential is added to a Pod, an annotation is added as well. |
| 77 | +It starts with `restarter.stackable.tech/expires-at.` and instructs the xref:commons-operator:restarter.adoc[restart-controller] to restart the Pod once the specified point in time is reached. |
| 78 | + |
| 79 | +Given the following Pod |
| 80 | + |
| 81 | +[source,yaml] |
| 82 | +---- |
| 83 | +kind: Pod |
| 84 | +metadata: |
| 85 | + annotations: |
| 86 | + restarter.stackable.tech/expires-at.b887492af14bfe84f10cb2ff1b60acb0: "2024-12-05T14:03:47.131570189+00:00" |
| 87 | + restarter.stackable.tech/expires-at.ea77192c1184326d33e8ee32cfe921ea: "2024-12-05T15:49:10.043722965+00:00" |
| 88 | +---- |
| 89 | + |
| 90 | +You can always determine the instant the Pod will be restarted by the xref:commons-operator:restarter.adoc[restart-controller] by taking the earliest timestamp, `2024-12-05T14:03:47.131570189+00:00` in this case. |
| 91 | + |
| 92 | +You can use this timestamp to check if your changes have been applied as intended. |
0 commit comments