Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions charts/kibana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,30 @@ HelmForge Elasticsearch subchart support, and static encryption key support.

It also includes Gateway API, dual-stack services, NetworkPolicy, PDB, External Secrets Operator integration, and focused Helm tests.

NetworkPolicy supports `networkPolicy.extraEgress` for appending egress rules
without replacing the generated DNS, Elasticsearch, and
`networkPolicy.egress.extra` controls.

## Install

```bash
helm repo add helmforge https://repo.helmforge.dev
helm repo update
helm install kibana helmforge/kibana \
--set elasticsearch.hosts[0]=http://elasticsearch:9200
helm install kibana helmforge/kibana
```

Elastic recommends running the same Elastic Stack version across Kibana and
Elasticsearch. The default chart version targets Kibana `9.4.2`.

## HelmForge Elasticsearch Subchart

The chart can deploy HelmForge Elasticsearch as an optional dependency for local
or self-contained environments:
The chart deploys HelmForge Elasticsearch by default so local and validation
installs are self-contained:

```yaml
bundledElasticsearch:
enabled: true

elasticsearch:
hosts:
- http://kibana-bundled-elasticsearch:9200

bundled-elasticsearch:
image:
tag: "9.4.2"
Expand All @@ -56,6 +55,9 @@ encryptionKeys:
For secured Elasticsearch clusters, use either basic auth or an Elasticsearch service account token:

```yaml
bundledElasticsearch:
enabled: false

elasticsearch:
hosts:
- https://elasticsearch:9200
Expand Down Expand Up @@ -98,13 +100,13 @@ gateway:
| `image.flavor` | Image flavor: `default` or `wolfi` | `default` |
| `image.tag` | Kibana image tag | `9.4.2` |
| `replicaCount` | Number of Kibana replicas | `1` |
| `elasticsearch.hosts` | Elasticsearch URLs | `[http://elasticsearch:9200]` |
| `bundledElasticsearch.enabled` | Enable HelmForge Elasticsearch dependency | `false` |
| `elasticsearch.hosts` | External Elasticsearch URLs used when bundled mode is disabled | `[http://elasticsearch:9200]` |
| `bundledElasticsearch.enabled` | Enable HelmForge Elasticsearch dependency | `true` |
| `elasticsearch.auth.type` | Elasticsearch auth mode: `none`, `basic`, `serviceAccountToken` | `none` |
| `elasticsearch.auth.existingSecret` | Secret containing Elasticsearch credentials | `""` |
| `elasticsearch.tls.enabled` | Configure Elasticsearch CA trust | `false` |
| `encryptionKeys.existingSecret` | Secret containing Kibana encryption keys | `""` |
| `waitForElasticsearch.enabled` | Wait for the first Elasticsearch endpoint before starting Kibana | `false` |
| `waitForElasticsearch.enabled` | Wait for the first Elasticsearch endpoint before starting Kibana | `true` |
| `service.ipFamilyPolicy` | Dual-stack ipFamilyPolicy | `null` |
| `ingress.enabled` | Create Kubernetes Ingress | `false` |
| `gateway.enabled` | Create Gateway API HTTPRoute | `false` |
Expand Down
1 change: 1 addition & 0 deletions charts/kibana/ci/bundled-elasticsearch-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ bundledElasticsearch:
# (<release>-bundled-elasticsearch), so this works with any release name.

bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch
clusterProfile: dev
image:
tag: "9.4.2"
Expand Down
5 changes: 2 additions & 3 deletions charts/kibana/ci/default-values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
elasticsearch:
hosts:
- http://elasticsearch:9200
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

resources:
requests:
Expand Down
6 changes: 3 additions & 3 deletions charts/kibana/ci/dual-stack-values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

service:
ipFamilyPolicy: PreferDualStack
ipFamilies:
- IPv4
- IPv6
20 changes: 6 additions & 14 deletions charts/kibana/ci/external-secrets-values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
elasticsearch:
auth:
type: serviceAccountToken
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

encryptionKeys:
requireForMultipleReplicas: true
Expand All @@ -10,23 +9,16 @@ externalSecrets:
enabled: true
skipCRDCheck: true
secretStoreRef:
name: cluster-secrets
name: helmforge-fake-store
kind: ClusterSecretStore
data:
- secretKey: service-account-token
remoteRef:
key: elastic/kibana
property: service-account-token
- secretKey: xpack-security-encryption-key
remoteRef:
key: elastic/kibana
property: security-key
key: test/kibana-security-encryption-key
- secretKey: xpack-reporting-encryption-key
remoteRef:
key: elastic/kibana
property: reporting-key
key: test/kibana-reporting-encryption-key
- secretKey: xpack-encrypted-saved-objects-encryption-key
remoteRef:
key: elastic/kibana
property: saved-objects-key
key: test/kibana-saved-objects-encryption-key
dataFrom: []
3 changes: 3 additions & 0 deletions charts/kibana/ci/gateway-api-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

gateway:
enabled: true
skipCRDCheck: true
Expand Down
3 changes: 3 additions & 0 deletions charts/kibana/ci/ingress-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

ingress:
enabled: true
ingressClassName: traefik
Expand Down
8 changes: 2 additions & 6 deletions charts/kibana/ci/k3d-values.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# SPDX-License-Identifier: Apache-2.0
elasticsearch:
hosts:
- http://elasticsearch:9200
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

encryptionKeys:
securityKey: "01234567890123456789012345678901"
reportingKey: "abcdefghijklmnopqrstuvwxyz123456"
encryptedSavedObjectsKey: "savedobjects01234567890123456789"

waitForElasticsearch:
enabled: true

resources:
requests:
cpu: 100m
Expand Down
3 changes: 3 additions & 0 deletions charts/kibana/ci/network-policy-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

networkPolicy:
enabled: true
ingress:
Expand Down
3 changes: 3 additions & 0 deletions charts/kibana/ci/persistence-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

persistence:
enabled: true
size: 1Gi
13 changes: 2 additions & 11 deletions charts/kibana/ci/security-values.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
elasticsearch:
hosts:
- https://elasticsearch:9200
auth:
type: basic
username: kibana_system
password: "change-me-in-production"
tls:
enabled: true
verificationMode: certificate
certificateAuthoritiesSecret: elasticsearch-ca
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch
Comment thread
coderabbitai[bot] marked this conversation as resolved.

encryptionKeys:
securityKey: "01234567890123456789012345678901"
Expand Down
3 changes: 3 additions & 0 deletions charts/kibana/ci/servicemonitor-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

serviceMonitor:
enabled: true
labels:
Expand Down
3 changes: 3 additions & 0 deletions charts/kibana/ci/wolfi-values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
bundled-elasticsearch:
fullnameOverride: kibana-ci-elasticsearch

image:
flavor: wolfi
34 changes: 12 additions & 22 deletions charts/kibana/docs/elasticsearch.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,35 @@
# Kibana Elasticsearch Connectivity

By default, Kibana connects to an external Elasticsearch endpoint:
By default, Kibana deploys the HelmForge Elasticsearch subchart and connects to
its generated in-cluster Service:

```yaml
elasticsearch:
hosts:
- http://elasticsearch:9200
bundledElasticsearch:
enabled: true
```

## HelmForge Elasticsearch Subchart
## External Elasticsearch

Enable the bundled HelmForge Elasticsearch subchart for local development or
self-contained test environments:
Disable the bundled dependency when connecting to a separately operated
Elasticsearch cluster:

```yaml
bundledElasticsearch:
enabled: true

elasticsearch:
hosts:
- http://kibana-bundled-elasticsearch:9200

bundled-elasticsearch:
image:
tag: "9.4.2"
```

When using a custom release name, set the host to the service rendered by the
aliased dependency:
enabled: false

```yaml
elasticsearch:
hosts:
- http://<release-name>-bundled-elasticsearch:9200
- http://elasticsearch:9200
```

For production, operate Elasticsearch separately and keep the subchart disabled.

## Secured Elasticsearch

```yaml
bundledElasticsearch:
enabled: false

elasticsearch:
hosts:
- https://elasticsearch:9200
Expand Down
4 changes: 0 additions & 4 deletions charts/kibana/examples/bundled-elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
bundledElasticsearch:
enabled: true

elasticsearch:
hosts:
- http://kibana-bundled-elasticsearch:9200

bundled-elasticsearch:
clusterProfile: dev
image:
Expand Down
3 changes: 3 additions & 0 deletions charts/kibana/examples/production.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
replicaCount: 2

bundledElasticsearch:
enabled: false

elasticsearch:
hosts:
- https://elasticsearch:9200
Expand Down
26 changes: 11 additions & 15 deletions charts/kibana/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,54 +1,50 @@
{{/* SPDX-License-Identifier: Apache-2.0 */}}
=============================================================================
Kibana deployed successfully!
=============================================================================

ACCESS:
1. Access
kubectl port-forward svc/{{ include "kibana.fullname" . }} -n {{ .Release.Namespace }} 5601:{{ .Values.service.port }}
Open: http://localhost:5601/

SERVICE:
2. Service
Internal URL: http://{{ include "kibana.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}
Status URL: http://{{ include "kibana.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}{{ include "kibana.probePath" . }}

IMAGE:
3. Image
{{ include "kibana.image" . }}

ELASTICSEARCH:
4. Elasticsearch
Hosts:
{{- range .Values.elasticsearch.hosts }}
- {{ . }}
{{- end }}
{{ include "kibana.elasticsearchHosts" . | nindent 5 }}
Auth type: {{ .Values.elasticsearch.auth.type }}
Bundled Elasticsearch subchart: {{ ternary "enabled" "disabled" .Values.bundledElasticsearch.enabled }}

CONFIGURATION:
5. Configuration
Persistence: {{ ternary "enabled" "disabled" .Values.persistence.enabled }}
Wolfi image: {{ ternary "enabled" "disabled" (eq .Values.image.flavor "wolfi") }}
ExternalSecret: {{ ternary "enabled" "disabled" .Values.externalSecrets.enabled }}

NETWORKING:
6. Networking
Ingress: {{ ternary "enabled" "disabled" .Values.ingress.enabled }}
Gateway API: {{ ternary "enabled" "disabled" .Values.gateway.enabled }}
NetworkPolicy: {{ ternary "enabled" "disabled" .Values.networkPolicy.enabled }}

OBSERVABILITY:
7. Observability
ServiceMonitor: {{ ternary "enabled" "disabled" .Values.serviceMonitor.enabled }}

OPERATIONS:
8. Operations
Run Helm tests:
helm test {{ .Release.Name }} -n {{ .Release.Namespace }}

Inspect pods:
kubectl get pods -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }}
kubectl logs -n {{ .Release.Namespace }} deploy/{{ include "kibana.fullname" . }}

SECURITY REMINDERS:
9. Security Reminders
1. Use static encryption keys for multiple replicas.
2. Use Elasticsearch TLS and authentication for production clusters.
3. Prefer ExternalSecret or existing Secrets for tokens and encryption keys.

DOCUMENTATION:
10. Documentation
Chart: https://helmforge.dev/docs/charts/kibana
Source: https://github.com/helmforgedev/charts/tree/main/charts/kibana
Kibana: https://www.elastic.co/kibana
Expand Down
11 changes: 11 additions & 0 deletions charts/kibana/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ app.kubernetes.io/part-of: helmforge
{{- if or $auth $keys .Values.extraEnv -}}true{{- else -}}false{{- end -}}
{{- end -}}

{{- define "kibana.waitForElasticsearchEnabled" -}}
{{- $externalPlainHTTP := and (not .Values.bundledElasticsearch.enabled) (eq .Values.elasticsearch.auth.type "none") (not .Values.elasticsearch.tls.enabled) -}}
{{- if and .Values.waitForElasticsearch.enabled (or .Values.bundledElasticsearch.enabled $externalPlainHTTP) -}}true{{- else -}}false{{- end -}}
{{- end -}}

{{- define "kibana.probePath" -}}
{{- $basePath := trimSuffix "/" .Values.server.basePath -}}
{{- if $basePath -}}
Expand All @@ -166,6 +171,12 @@ app.kubernetes.io/part-of: helmforge
{{- if and .Values.bundledElasticsearch.enabled (eq (include "kibana.bundledElasticsearchSecured" .) "true") -}}
{{- fail "bundled Elasticsearch with security enabled (bundled-elasticsearch.security.enabled=true or clusterProfile=production-ha) is not supported in bundled mode: this chart wires only the plain-HTTP Service URL, not TLS CA verification or auth, so Kibana would connect to the wrong (https) endpoint. Use external mode instead -- set bundledElasticsearch.enabled=false and configure elasticsearch.hosts + elasticsearch.tls + elasticsearch.auth against your secured cluster." -}}
{{- end -}}
{{- if and .Values.bundledElasticsearch.enabled (ne $auth "none") -}}
{{- fail "elasticsearch.auth.type must be none when bundledElasticsearch.enabled=true because the bundled dev profile is unauthenticated plain HTTP. Disable bundledElasticsearch to use external secured Elasticsearch." -}}
{{- end -}}
{{- if and .Values.bundledElasticsearch.enabled .Values.elasticsearch.tls.enabled -}}
{{- fail "elasticsearch.tls.enabled must be false when bundledElasticsearch.enabled=true because the bundled dev profile is plain HTTP. Disable bundledElasticsearch to use external TLS Elasticsearch." -}}
{{- end -}}
{{- if not (has $auth (list "none" "basic" "serviceAccountToken")) -}}
{{- fail "elasticsearch.auth.type must be one of: none, basic, serviceAccountToken" -}}
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/kibana/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
priorityClassName: {{ . | quote }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- if .Values.waitForElasticsearch.enabled }}
{{- if eq (include "kibana.waitForElasticsearchEnabled" .) "true" }}
initContainers:
- name: wait-for-elasticsearch
image: "{{ .Values.waitForElasticsearch.image.repository }}:{{ .Values.waitForElasticsearch.image.tag }}"
Expand Down
Loading