Skip to content

Commit 976e43e

Browse files
cychiangmistercrunch
authored andcommitted
Install superset in Kubernetes with helm chart (apache#4923)
* Add helm chart to install superset in kubernetes * set resources into unlimited * Add descriptions to Chart.yaml * add an entry in docs/installation.rst
1 parent 5d6e59a commit 976e43e

10 files changed

+259
-0
lines changed

docs/installation.rst

+15
Original file line numberDiff line numberDiff line change
@@ -650,3 +650,18 @@ To setup StatsD logging, it's a matter of configuring the logger in your
650650
651651
Note that it's also possible to implement you own logger by deriving
652652
``superset.stats_logger.BaseStatsLogger``.
653+
654+
655+
Install Superset with helm in Kubernetes
656+
--------------
657+
658+
You can install Superset into Kubernetes with Helm <https://helm.sh/>. The chart is
659+
located in ``install/helm``.
660+
661+
To install Superset into your Kubernetes:
662+
663+
.. code-block:: bash
664+
665+
helm upgrade --install superset ./install/helm/superset
666+
667+
Note that the above command will install Superset into ``default`` namespace of your Kubernetes cluster.

install/helm/superset/.helmignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

install/helm/superset/Chart.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
appVersion: "1.0"
3+
description: A Helm chart for Kubernetes
4+
name: superset
5+
maintainers:
6+
- name: Chuan-Yen Chiang
7+
8+
url: https://github.com/cychiang
9+
version: 0.1.0
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range .Values.ingress.hosts }}
4+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
5+
{{- end }}
6+
{{- else if contains "NodePort" .Values.service.type }}
7+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "superset.fullname" . }})
8+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
9+
echo http://$NODE_IP:$NODE_PORT
10+
{{- else if contains "LoadBalancer" .Values.service.type }}
11+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
12+
You can watch the status of by running 'kubectl get svc -w {{ template "superset.fullname" . }}'
13+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "superset.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
14+
echo http://$SERVICE_IP:{{ .Values.service.port }}
15+
{{- else if contains "ClusterIP" .Values.service.type }}
16+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "superset.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
17+
echo "Visit http://127.0.0.1:8080 to use your application"
18+
kubectl port-forward $POD_NAME 8080:80
19+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "superset.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "superset.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "superset.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: superset-configmap
5+
labels:
6+
app: {{ template "superset.name" . }}
7+
chart: {{ template "superset.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
data:
11+
{{ (.Files.Glob "config/*").AsConfig | indent 2 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
apiVersion: apps/v1beta2
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "superset.fullname" . }}
5+
labels:
6+
app: {{ template "superset.name" . }}
7+
chart: {{ template "superset.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
replicas: {{ .Values.replicaCount }}
12+
selector:
13+
matchLabels:
14+
app: {{ template "superset.name" . }}
15+
release: {{ .Release.Name }}
16+
template:
17+
metadata:
18+
labels:
19+
app: {{ template "superset.name" . }}
20+
release: {{ .Release.Name }}
21+
spec:
22+
containers:
23+
- name: {{ .Chart.Name }}
24+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
25+
imagePullPolicy: {{ .Values.image.pullPolicy }}
26+
volumeMounts:
27+
- name: superset-config
28+
mountPath: /etc/superset/
29+
ports:
30+
- name: http
31+
containerPort: 8088
32+
protocol: TCP
33+
resources:
34+
{{ toYaml .Values.resources | indent 12 }}
35+
{{- with .Values.nodeSelector }}
36+
nodeSelector:
37+
{{ toYaml . | indent 8 }}
38+
{{- end }}
39+
{{- with .Values.affinity }}
40+
affinity:
41+
{{ toYaml . | indent 8 }}
42+
{{- end }}
43+
{{- with .Values.tolerations }}
44+
tolerations:
45+
{{ toYaml . | indent 8 }}
46+
{{- end }}
47+
volumes:
48+
- name: "superset-config"
49+
configMap:
50+
name: superset-configmap
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "superset.fullname" . -}}
3+
{{- $ingressPath := .Values.ingress.path -}}
4+
apiVersion: extensions/v1beta1
5+
kind: Ingress
6+
metadata:
7+
name: {{ $fullName }}
8+
labels:
9+
app: {{ template "superset.name" . }}
10+
chart: {{ template "superset.chart" . }}
11+
release: {{ .Release.Name }}
12+
heritage: {{ .Release.Service }}
13+
{{- with .Values.ingress.annotations }}
14+
annotations:
15+
{{ toYaml . | indent 4 }}
16+
{{- end }}
17+
spec:
18+
{{- if .Values.ingress.tls }}
19+
tls:
20+
{{- range .Values.ingress.tls }}
21+
- hosts:
22+
{{- range .hosts }}
23+
- {{ . }}
24+
{{- end }}
25+
secretName: {{ .secretName }}
26+
{{- end }}
27+
{{- end }}
28+
rules:
29+
{{- range .Values.ingress.hosts }}
30+
- host: {{ . }}
31+
http:
32+
paths:
33+
- path: {{ $ingressPath }}
34+
backend:
35+
serviceName: {{ $fullName }}
36+
servicePort: http
37+
{{- end }}
38+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ template "superset.fullname" . }}
5+
labels:
6+
app: {{ template "superset.name" . }}
7+
chart: {{ template "superset.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
type: {{ .Values.service.type }}
12+
ports:
13+
- port: {{ .Values.service.port }}
14+
targetPort: http
15+
protocol: TCP
16+
name: http
17+
selector:
18+
app: {{ template "superset.name" . }}
19+
release: {{ .Release.Name }}

install/helm/superset/values.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Default values for superset.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
replicaCount: 1
6+
7+
image:
8+
repository: amancevice/superset
9+
tag: latest
10+
pullPolicy: IfNotPresent
11+
12+
service:
13+
type: NodePort
14+
port: 8088
15+
16+
ingress:
17+
enabled: false
18+
annotations: {}
19+
# kubernetes.io/ingress.class: nginx
20+
# kubernetes.io/tls-acme: "true"
21+
path: /
22+
hosts:
23+
- chart-example.local
24+
tls: []
25+
# - secretName: chart-example-tls
26+
# hosts:
27+
# - chart-example.local
28+
29+
resources: {}
30+
# We usually recommend not to specify default resources and to leave this as a conscious
31+
# choice for the user. This also increases chances charts run on environments with little
32+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
33+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
34+
# limits:
35+
# cpu: 100m
36+
# memory: 128Mi
37+
# requests:
38+
# cpu: 100m
39+
# memory: 128Mi
40+
41+
nodeSelector: {}
42+
43+
tolerations: []
44+
45+
affinity: {}

0 commit comments

Comments
 (0)