|  | 
|  | 1 | +--- | 
|  | 2 | +tags: | 
|  | 3 | +  - Enterprise Option | 
|  | 4 | +displayed_sidebar: docsEnglish | 
|  | 5 | +--- | 
|  | 6 | + | 
|  | 7 | +# Configure a custom values file for ScalarDB Analytics server | 
|  | 8 | + | 
|  | 9 | +import CertificateManagement from '/src/components/en-us/_certificate-management.mdx'; | 
|  | 10 | + | 
|  | 11 | +This document explains how to create your custom values file for the ScalarDB Analytics server chart. For details on the parameters, see the [README](https://github.com/scalar-labs/helm-charts/blob/main/charts/scalardb-analytics-server/README.md) of the ScalarDB Analytics server chart. | 
|  | 12 | + | 
|  | 13 | +## Required configurations | 
|  | 14 | + | 
|  | 15 | +This section describes the required image, database, and service configurations. | 
|  | 16 | + | 
|  | 17 | +### Image configurations | 
|  | 18 | + | 
|  | 19 | +You must set `scalarDbAnalyticsServer.image.repository`. Be sure to specify the ScalarDB Analytics server container image so that you can pull the image from the container repository. | 
|  | 20 | + | 
|  | 21 | +```yaml | 
|  | 22 | +scalarDbAnalyticsServer: | 
|  | 23 | +  image: | 
|  | 24 | +    repository: <SCALARDB_ANALYTICS_SERVER_CONTAINER_IMAGE> | 
|  | 25 | +``` | 
|  | 26 | +
 | 
|  | 27 | +### Database configurations | 
|  | 28 | +
 | 
|  | 29 | +You must set `scalarDbAnalyticsServer.properties`. For details about configuring the value of this parameter, see [ScalarDB Analytics server configuration](https://scalardb.scalar-labs.com/docs/latest/scalardb-analytics/configuration). | 
|  | 30 | + | 
|  | 31 | +```yaml | 
|  | 32 | +scalarDbAnalyticsServer: | 
|  | 33 | +  properties: | | 
|  | 34 | +    scalar.db.analytics.server.db.url=jdbc:postgresql://localhost:5432/scalardb_analytics | 
|  | 35 | +    scalar.db.analytics.server.db.username=analytics_user | 
|  | 36 | +    scalar.db.analytics.server.db.password=your_secure_password | 
|  | 37 | +``` | 
|  | 38 | + | 
|  | 39 | +### Service configurations | 
|  | 40 | + | 
|  | 41 | +You must set `scalarDbAnalyticsServer.service.type` to specify the Service resource type of Kubernetes. | 
|  | 42 | + | 
|  | 43 | +If the ScalarDB Analytics server accepts client requests from inside of the Kubernetes cluster only (for example, if you deploy your client applications on the same Kubernetes cluster as Scalar products), you can set `scalarDbAnalyticsServer.service.type` to `ClusterIP`. This configuration doesn't create any load balancers provided by cloud service providers. | 
|  | 44 | + | 
|  | 45 | +```yaml | 
|  | 46 | +scalarDbAnalyticsServer: | 
|  | 47 | +  service: | 
|  | 48 | +    type: ClusterIP | 
|  | 49 | +``` | 
|  | 50 | + | 
|  | 51 | +If you want to use a load balancer provided by a cloud service provider to accept client requests from outside of the Kubernetes cluster, you need to set `scalarDbAnalyticsServer.service.type` to `LoadBalancer`. | 
|  | 52 | + | 
|  | 53 | +```yaml | 
|  | 54 | +scalarDbAnalyticsServer: | 
|  | 55 | +  service: | 
|  | 56 | +    type: LoadBalancer | 
|  | 57 | +``` | 
|  | 58 | + | 
|  | 59 | +If you want to configure the load balancer via annotations, you can also set annotations to `scalarDbAnalyticsServer.service.annotations`. | 
|  | 60 | + | 
|  | 61 | +```yaml | 
|  | 62 | +scalarDbAnalyticsServer: | 
|  | 63 | +  service: | 
|  | 64 | +    type: LoadBalancer | 
|  | 65 | +    annotations: | 
|  | 66 | +      service.beta.kubernetes.io/aws-load-balancer-internal: "true" | 
|  | 67 | +      service.beta.kubernetes.io/aws-load-balancer-type: "nlb" | 
|  | 68 | +``` | 
|  | 69 | + | 
|  | 70 | +## Optional configurations | 
|  | 71 | + | 
|  | 72 | +This section describes the optional configurations. | 
|  | 73 | + | 
|  | 74 | +### Secret configurations (recommended in production environments) | 
|  | 75 | + | 
|  | 76 | +To use environment variables to set some properties (for example, credentials), you can use `scalarDbAnalyticsServer.secretName` to specify the Secret resource that includes some credentials. | 
|  | 77 | + | 
|  | 78 | +For example, you can set credentials for a backend database (`scalar.db.analytics.server.db.username` and `scalar.db.analytics.server.db.password`) by using environment variables, which makes your pods more secure. | 
|  | 79 | + | 
|  | 80 | +```yaml | 
|  | 81 | +scalarDbAnalyticsServer: | 
|  | 82 | +  secretName: "scalardb-analytics-server-credentials-secret" | 
|  | 83 | +``` | 
|  | 84 | + | 
|  | 85 | +:::tip | 
|  | 86 | + | 
|  | 87 | +The ScalarDB Analytics server automatically loads configurations from specific environment variables. The naming rule for the environment variables is as follows: | 
|  | 88 | + | 
|  | 89 | +- Capitalize all characters of the property name. | 
|  | 90 | +- Replace periods (`.`) with underscores (`_`). | 
|  | 91 | + | 
|  | 92 | +For example, if you want to set `scalar.db.analytics.server.db.username` and `scalar.db.analytics.server.db.password` via environment variables, you must set environment variables `SCALAR_DB_ANALYTICS_SERVER_DB_USERNAME` and `SCALAR_DB_ANALYTICS_SERVER_DB_PASSWORD`. | 
|  | 93 | + | 
|  | 94 | +In this case, you don't need to set `scalar.db.analytics.server.db.username` and `scalar.db.analytics.server.db.password` in `scalarDbAnalyticsServer.properties`. Setting only the environment variables is enough. | 
|  | 95 | + | 
|  | 96 | +For example, you can create such a secret resource that includes `SCALAR_DB_ANALYTICS_SERVER_DB_USERNAME` and `SCALAR_DB_ANALYTICS_SERVER_DB_PASSWORD` as follows: | 
|  | 97 | + | 
|  | 98 | +```console | 
|  | 99 | +kubectl create secret generic scalardb-analytics-server-credentials-secret \ | 
|  | 100 | +  --from-literal=SCALAR_DB_ANALYTICS_SERVER_DB_USERNAME=analytics_user \ | 
|  | 101 | +  --from-literal=SCALAR_DB_ANALYTICS_SERVER_DB_PASSWORD=your_secure_password | 
|  | 102 | +``` | 
|  | 103 | + | 
|  | 104 | +::: | 
|  | 105 | + | 
|  | 106 | +### SecurityContext configurations (the default value is recommended) | 
|  | 107 | + | 
|  | 108 | +To set SecurityContext and PodSecurityContext for ScalarDB Analytics server pods, you can use `scalarDbAnalyticsServer.securityContext` and `scalarDbAnalyticsServer.podSecurityContext`. | 
|  | 109 | + | 
|  | 110 | +You can configure SecurityContext and PodSecurityContext by using the same syntax as SecurityContext and PodSecurityContext in Kubernetes. For more details on the SecurityContext and PodSecurityContext configurations in Kubernetes, see [Configure a Security Context for a Pod or Container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). | 
|  | 111 | + | 
|  | 112 | +```yaml | 
|  | 113 | +scalarDbAnalyticsServer: | 
|  | 114 | +  podSecurityContext: | 
|  | 115 | +    seccompProfile: | 
|  | 116 | +      type: RuntimeDefault | 
|  | 117 | +  securityContext: | 
|  | 118 | +    capabilities: | 
|  | 119 | +      drop: | 
|  | 120 | +        - ALL | 
|  | 121 | +    runAsNonRoot: true | 
|  | 122 | +    allowPrivilegeEscalation: false | 
|  | 123 | +``` | 
|  | 124 | + | 
|  | 125 | +### TLS configurations (optional based on your environment) | 
|  | 126 | + | 
|  | 127 | +You can enable TLS in: | 
|  | 128 | + | 
|  | 129 | +- The communications between the ScalarDB Analytics server and its client. | 
|  | 130 | + | 
|  | 131 | +<CertificateManagement /> | 
|  | 132 | + | 
|  | 133 | +#### Enable TLS | 
|  | 134 | + | 
|  | 135 | +You can enable TLS in all ScalarDB Analytics server connections by using the following configurations: | 
|  | 136 | + | 
|  | 137 | +```yaml | 
|  | 138 | +scalarDbAnalyticsServer: | 
|  | 139 | +  properties: | | 
|  | 140 | +    ...(omit)... | 
|  | 141 | +    scalar.db.analytics.server.tls.enabled=true | 
|  | 142 | +    scalar.db.analytics.server.tls.cert_chain_path=/tls/scalardb-analytics-server/certs/tls.crt | 
|  | 143 | +    scalar.db.analytics.server.tls.private_key_path=/tls/scalardb-analytics-server/certs/tls.key | 
|  | 144 | +  tls: | 
|  | 145 | +    enabled: true | 
|  | 146 | +``` | 
|  | 147 | + | 
|  | 148 | +:::note | 
|  | 149 | + | 
|  | 150 | +Based on the specification of the private key and certificate that are created by cert-manager and the specification of this chart, you must set the fixed file path and file name when you enable the TLS feature. Please set the above file paths and file names as is for `scalar.db.analytics.server.tls.cert_chain_path` and `scalar.db.analytics.server.tls.private_key_path`. | 
|  | 151 | + | 
|  | 152 | +::: | 
|  | 153 | + | 
|  | 154 | + | 
|  | 155 | +##### Use your private key and certificate files | 
|  | 156 | + | 
|  | 157 | +You can set your private key and certificate files by using the following configurations: | 
|  | 158 | + | 
|  | 159 | +```yaml | 
|  | 160 | +scalarDbAnalyticsServer: | 
|  | 161 | +  tls: | 
|  | 162 | +    enabled: true | 
|  | 163 | +    caRootCertSecret: "scalardb-analytics-server-tls-ca" | 
|  | 164 | +    certChainSecret: "scalardb-analytics-server-tls-cert" | 
|  | 165 | +    privateKeySecret: "scalardb-analytics-server-tls-key" | 
|  | 166 | +``` | 
|  | 167 | + | 
|  | 168 | +In this case, you have to create secret resources that include private key and certificate files for the ScalarDB Analytics server as follows, replacing the contents in the angle brackets as described: | 
|  | 169 | + | 
|  | 170 | +```console | 
|  | 171 | +kubectl create secret generic scalardb-analytics-server-tls-ca --from-file=ca.crt=<PATH_TO_YOUR_CA_CERTIFICATE_FILE_FOR_SCALARDB_ANALYTICS_SERVER> -n <NAMESPACE> | 
|  | 172 | +kubectl create secret generic scalardb-analytics-server-tls-cert --from-file=tls.crt=<PATH_TO_YOUR_CERTIFICATE_FILE_FOR_SCALARDB_ANALYTICS_SERVER> -n <NAMESPACE> | 
|  | 173 | +kubectl create secret generic scalardb-analytics-server-tls-key --from-file=tls.key=<PATH_TO_YOUR_PRIVATE_KEY_FILE_FOR_SCALARDB_ANALYTICS_SERVER> -n <NAMESPACE> | 
|  | 174 | +``` | 
|  | 175 | + | 
|  | 176 | +For more details on how to prepare private key and certificate files, see [How to create private key and certificate files for Scalar products](../scalar-kubernetes/HowToCreateKeyAndCertificateFiles.mdx). | 
|  | 177 | + | 
|  | 178 | +##### Use a trusted CA with cert-manager to manage your private key and certificate files | 
|  | 179 | + | 
|  | 180 | +You can manage your private key and certificate files with cert-manager by using the following configurations, replacing the content in the angle brackets as described: | 
|  | 181 | + | 
|  | 182 | +:::note | 
|  | 183 | + | 
|  | 184 | +* If you want to use cert-manager, you must deploy cert-manager and prepare the `Issuers` resource. For details, see the cert-manager documentation, [Installation](https://cert-manager.io/docs/installation/) and [Issuer Configuration](https://cert-manager.io/docs/configuration/). | 
|  | 185 | +* By default, Scalar Helm Chart creates a `Certificate` resource that satisfies the certificate requirements of Scalar products. The default certificate configuration is recommended, but if you use a custom certificate configuration, you must satisfy the certificate requirements of Scalar products. For details, see [How to create private key and certificate files for Scalar products](../scalar-kubernetes/HowToCreateKeyAndCertificateFiles.mdx#certificate-requirements). | 
|  | 186 | + | 
|  | 187 | +::: | 
|  | 188 | + | 
|  | 189 | +```yaml | 
|  | 190 | +scalarDbAnalyticsServer: | 
|  | 191 | +  tls: | 
|  | 192 | +    enabled: true | 
|  | 193 | +    certManager: | 
|  | 194 | +      enabled: true | 
|  | 195 | +      issuerRef: | 
|  | 196 | +        name: <YOUR_TRUSTED_CA> | 
|  | 197 | +      dnsNames: | 
|  | 198 | +        - server.analytics.scalardb.example.com | 
|  | 199 | +``` | 
|  | 200 | + | 
|  | 201 | +In this case, cert-manager issues your private key and certificate files by using your trusted issuer. You don't need to mount your private key and certificate files manually. | 
|  | 202 | + | 
|  | 203 | +##### Use a self-signed CA with cert-manager to manage your private key and certificate files | 
|  | 204 | + | 
|  | 205 | +You can manage your private key and self-signed certificate files with cert-manager by using the following configurations: | 
|  | 206 | + | 
|  | 207 | +:::note | 
|  | 208 | + | 
|  | 209 | +* If you want to use cert-manager, you must deploy cert-manager. For more details on how to deploy cert-manager, see [Installation](https://cert-manager.io/docs/installation/) in the official documentation for cert-manager. | 
|  | 210 | +* By default, Scalar Helm Chart creates a `Certificate` resource that satisfies the certificate requirements of Scalar products. The default certificate configuration is recommended, but if you use a custom certificate configuration, you must satisfy the certificate requirements of Scalar products. See [How to create private key and certificate files for Scalar products](../scalar-kubernetes/HowToCreateKeyAndCertificateFiles.mdx#certificate-requirements). | 
|  | 211 | + | 
|  | 212 | +::: | 
|  | 213 | + | 
|  | 214 | +```yaml | 
|  | 215 | +scalarDbAnalyticsServer: | 
|  | 216 | +  tls: | 
|  | 217 | +    enabled: true | 
|  | 218 | +    certManager: | 
|  | 219 | +      enabled: true | 
|  | 220 | +      selfSigned: | 
|  | 221 | +        enabled: true | 
|  | 222 | +      dnsNames: | 
|  | 223 | +        - server.analytics.scalardb.example.com | 
|  | 224 | +``` | 
|  | 225 | + | 
|  | 226 | +In this case, Scalar Helm Charts and cert-manager issue your private key and self-signed certificate files. You don't need to mount your private key and certificate files manually. | 
|  | 227 | + | 
|  | 228 | +##### Set custom authority for TLS communications | 
|  | 229 | + | 
|  | 230 | +You can set the custom authority for TLS communications by using `scalarDbAnalyticsServer.tls.overrideAuthority`. This value doesn't change what host is actually connected. This value is intended for testing but may safely be used outside of tests as an alternative to DNS overrides. For example, you can specify the hostname presented in the certificate chain file that you set by using `scalarDbAnalyticsServer.tls.certChainSecret`. This chart uses this value for health check requests (`startupProbe` and `livenessProbe`). | 
|  | 231 | + | 
|  | 232 | +```yaml | 
|  | 233 | +scalarDbAnalyticsServer: | 
|  | 234 | +  tls: | 
|  | 235 | +    enabled: true | 
|  | 236 | +    overrideAuthority: "server.analytics.scalardb.example.com" | 
|  | 237 | +``` | 
|  | 238 | + | 
|  | 239 | +### Affinity configurations (optional based on your environment) | 
|  | 240 | + | 
|  | 241 | +To control pod deployment by using affinity and anti-affinity in Kubernetes, you can use `scalarDbAnalyticsServer.affinity`. | 
|  | 242 | + | 
|  | 243 | +You can configure affinity and anti-affinity by using the same syntax for affinity and anti-affinity in Kubernetes. For more details on configuring affinity in Kubernetes, see [Assigning Pods to Nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/). | 
|  | 244 | + | 
|  | 245 | +```yaml | 
|  | 246 | +scalarDbAnalyticsServer: | 
|  | 247 | +  affinity: | 
|  | 248 | +    podAntiAffinity: | 
|  | 249 | +      preferredDuringSchedulingIgnoredDuringExecution: | 
|  | 250 | +        - podAffinityTerm: | 
|  | 251 | +            labelSelector: | 
|  | 252 | +              matchExpressions: | 
|  | 253 | +                - key: app.kubernetes.io/name | 
|  | 254 | +                  operator: In | 
|  | 255 | +                  values: | 
|  | 256 | +                    - scalardb-analytics-server | 
|  | 257 | +                - key: app.kubernetes.io/app | 
|  | 258 | +                  operator: In | 
|  | 259 | +                  values: | 
|  | 260 | +                    - scalardb-analytics-server | 
|  | 261 | +            topologyKey: kubernetes.io/hostname | 
|  | 262 | +          weight: 50 | 
|  | 263 | +``` | 
|  | 264 | + | 
|  | 265 | +### Taint and toleration configurations (optional based on your environment) | 
|  | 266 | + | 
|  | 267 | +If you want to control pod deployment by using the taints and tolerations in Kubernetes, you can use `scalarDbAnalyticsServer.tolerations`. | 
|  | 268 | + | 
|  | 269 | +You can configure taints and tolerations by using the same syntax as the tolerations in Kubernetes. For details on configuring tolerations in Kubernetes, see the official Kubernetes documentation [Taints and Tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/). | 
|  | 270 | + | 
|  | 271 | +```yaml | 
|  | 272 | +scalarDbAnalyticsServer: | 
|  | 273 | +  tolerations: | 
|  | 274 | +    - effect: NoSchedule | 
|  | 275 | +      key: scalar-labs.com/dedicated-node | 
|  | 276 | +      operator: Equal | 
|  | 277 | +      value: scalardb-analytics-server | 
|  | 278 | +``` | 
0 commit comments