|
| 1 | +--- |
| 2 | +# |
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 4 | +# or more contributor license agreements. See the NOTICE file |
| 5 | +# distributed with this work for additional information |
| 6 | +# regarding copyright ownership. The ASF licenses this file |
| 7 | +# to you under the Apache License, Version 2.0 (the |
| 8 | +# "License"); you may not use this file except in compliance |
| 9 | +# with the License. You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, |
| 14 | +# software distributed under the License is distributed on an |
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | +# KIND, either express or implied. See the License for the |
| 17 | +# specific language governing permissions and limitations |
| 18 | +# under the License. |
| 19 | +# |
| 20 | +title: Configuring Helm for Production |
| 21 | +linkTitle: Configuring Helm |
| 22 | +type: docs |
| 23 | +weight: 601 |
| 24 | +--- |
| 25 | + |
| 26 | +This guide provides instructions for configuring the Polaris Helm chart for a production environment. For full list of chart values, see the [main Helm chart documentation](../../helm/). |
| 27 | + |
| 28 | +The default Helm chart values are suitable for development and testing, but they are not recommended for production. Following are the key areas to consider for production deployment. |
| 29 | + |
| 30 | +## Persistence |
| 31 | + |
| 32 | +By default, the Polaris Helm chart uses an `in-memory` metastore, which is not suitable for production. A persistent backend must be configured to ensure data is not lost when pods restart. |
| 33 | + |
| 34 | +To use a persistent backend, `persistence.type` must be set to `relational-jdbc`, and a Kubernetes secret containing the database connection details must be provided. |
| 35 | + |
| 36 | +```yaml |
| 37 | +persistence: |
| 38 | + type: relational-jdbc |
| 39 | + relationalJdbc: |
| 40 | + secret: |
| 41 | + name: "polaris-persistence-secret" # A secret containing db credentials |
| 42 | + username: "username" |
| 43 | + password: "password" |
| 44 | + jdbcUrl: "jdbcUrl" |
| 45 | +``` |
| 46 | +
|
| 47 | +## Resource Management |
| 48 | +
|
| 49 | +For a production environment, it is crucial to define resource requests and limits for the Polaris pods. Resource requests ensure that pods are allocated enough resources to run, while limits prevent them from consuming too many resources on the node. |
| 50 | +
|
| 51 | +Resource requests and limits can be set in the `values.yaml` file: |
| 52 | + |
| 53 | +```yaml |
| 54 | +resources: |
| 55 | + requests: |
| 56 | + memory: "8Gi" |
| 57 | + cpu: "4" |
| 58 | + limits: |
| 59 | + memory: "8Gi" |
| 60 | + cpu: "4" |
| 61 | +``` |
| 62 | + |
| 63 | +Adjust these values based on expected workload and available cluster resources. |
| 64 | + |
| 65 | +## Authentication |
| 66 | + |
| 67 | +In a multi-replica production environment, all Polaris pods must share the same token signing keys. The default chart generates random keys for each pod, which will cause token validation failures. |
| 68 | + |
| 69 | +To use a shared set of keys, a Kubernetes secret to store an RSA key pair or a symmetric key must first be created. |
| 70 | + |
| 71 | +### RSA Key Pair |
| 72 | + |
| 73 | +```yaml |
| 74 | +authentication: |
| 75 | + tokenBroker: |
| 76 | + type: rsa-key-pair |
| 77 | + secret: |
| 78 | + name: "polaris-rsa-key-pair-secret" # A secret containing the RSA key pair |
| 79 | + rsaKeyPair: |
| 80 | + publicKey: "public.pem" |
| 81 | + privateKey: "private.pem" |
| 82 | +``` |
| 83 | + |
| 84 | +### Symmetric Key |
| 85 | + |
| 86 | +```yaml |
| 87 | +authentication: |
| 88 | + tokenBroker: |
| 89 | + type: symmetric-key |
| 90 | + secret: |
| 91 | + name: "polaris-symmetric-key-secret" # A secret containing the symmetric key |
| 92 | + symmetricKey: |
| 93 | + secretKey: "symmetric.key" |
| 94 | +``` |
| 95 | + |
| 96 | +## Scaling |
| 97 | + |
| 98 | +For high availability, multiple replicas of the Polaris server can be run. This requires a persistent backend to be configured as described above. |
| 99 | + |
| 100 | +### Static Replicas |
| 101 | + |
| 102 | +`replicaCount` must be set to the desired number of pods. |
| 103 | + |
| 104 | +```yaml |
| 105 | +replicaCount: 3 |
| 106 | +``` |
| 107 | + |
| 108 | +### Autoscaling |
| 109 | + |
| 110 | +`autoscaling` can be enabled to define the minimum and maximum number of replicas, and CPU or memory utilization targets. |
| 111 | + |
| 112 | +```yaml |
| 113 | +autoscaling: |
| 114 | + enabled: true |
| 115 | + minReplicas: 2 |
| 116 | + maxReplicas: 5 |
| 117 | + targetCPUUtilizationPercentage: 80 |
| 118 | + targetMemoryUtilizationPercentage: 80 |
| 119 | +``` |
| 120 | + |
| 121 | +### Pod Topology Spreading |
| 122 | + |
| 123 | +For better fault tolerance, `topologySpreadConstraints` can be used to distribute pods across different nodes, racks, or availability zones. This helps prevent a single infrastructure failure from taking down all Polaris replicas. |
| 124 | + |
| 125 | +Here is an example that spreads pods across different zones and keeps the number of pods in each zone from differing by more than one: |
| 126 | + |
| 127 | +```yaml |
| 128 | +topologySpreadConstraints: |
| 129 | + - maxSkew: 1 |
| 130 | + topologyKey: "topology.kubernetes.io/zone" |
| 131 | + whenUnsatisfiable: "DoNotSchedule" |
| 132 | +``` |
0 commit comments