Skip to content

Commit

Permalink
[documentation][deploy] Improve helm deployment script to deploy Puls…
Browse files Browse the repository at this point in the history
…ar to minikube (apache#2363)

* [documentation][deploy] Update deployment instructions for deploying to Minikube

* Enable functions workers

* [documentation][deploy] Improve helm deployment script to deploy Pulsar to minikube

 ### Changes

- update the helm scripts: bookie/autorecovery/broker pods should wait until metadata is initialized
- disable `autoRecovery` on bookies since we start `AutoRecovery` in separate pods
- enable function worker on brokers
- provide a values file for minikube
- update documentation for using helm chart to deploy a cluster to minikube

* move the service type definition to values file
  • Loading branch information
sijie authored and merlimat committed Aug 16, 2018
1 parent 722dac5 commit 2bc4812
Show file tree
Hide file tree
Showing 13 changed files with 500 additions and 11 deletions.
54 changes: 54 additions & 0 deletions deployment/kubernetes/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,57 @@

This directory contains the Helm Chart required
to do a complete Pulsar deployment on Kubernetes.

## Install Helm

Before you start, you need to install helm.
Following [helm documentation](https://docs.helm.sh/using_helm/#installing-helm) to install it.

## Deploy Pulsar

### Minikube

#### Install Minikube

[Install and configure minikube](https://github.com/kubernetes/minikube#installation) with
a [VM driver](https://github.com/kubernetes/minikube#requirements), e.g. `kvm2` on Linux
or `hyperkit` or `VirtualBox` on macOS.

#### Create a K8S cluster on Minikube

```
minikube start --memory=8192 --cpus=4 \
--kubernetes-version=v1.10.5
```

#### Set kubectl to use Minikube.

```
kubectl config use-context minikube
```

After you created a K8S cluster on Minikube, you can access its dashboard via following command:

```
minikube dashboard
```

The command will automatically trigger open a webpage in your browser.

#### Install Pulsar Chart

Assume you already cloned pulsar repo in `PULSAR_HOME` directory.

1. Go to Pulsar helm chart directory
```shell
cd ${PULSAR_HOME}/deployment/kubernetes/helm
```
1. Install helm chart.
```shell
helm install --values pulsar/values-mini.yaml ./pulsar
```

Once the helm chart is completed on installation, you can access the cluster via:

- Web service url: `http://$(minikube ip):30001/`
- Pulsar service url: `pulsar://$(minikube ip):30002/`
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ spec:
command: ["sh", "-c"]
args:
- >-
until nslookup {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ add (.Values.zookeeper.replicaCount | int) -1 }}.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ .Values.namespace }}; do
until bin/pulsar zookeeper-shell -server {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }} ls /admin/clusters/{{ template "pulsar.fullname" . }}; do
sleep 3;
done;
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ data:
zkServers:
{{- $global := . }}
{{ range $i, $e := until (.Values.zookeeper.replicaCount | int) }}{{ if ne $i 0 }},{{ end }}{{ printf "%s-%s-%s-%d.%s-%s-%s" $global.Release.Name $global.Chart.Name $global.Values.zookeeper.component $i $global.Release.Name $global.Chart.Name $global.Values.zookeeper.component }}{{ end }}
# disable auto recovery on bookies since we will start AutoRecovery in separated pods
autoRecoveryDaemonEnabled: "false"
{{ toYaml .Values.bookkeeper.configData | indent 2 }}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ spec:
command: ["sh", "-c"]
args:
- >-
until nslookup {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ add (.Values.zookeeper.replicaCount | int) -1 }}.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ .Values.namespace }}; do
until bin/pulsar zookeeper-shell -server {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }} ls /admin/clusters/{{ template "pulsar.fullname" . }}; do
sleep 3;
done;
# This initContainer will make sure that the bookeeper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ data:
{{- $global := . }}
{{ range $i, $e := until (.Values.zookeeper.replicaCount | int) }}{{ if ne $i 0 }},{{ end }}{{ printf "%s-%s-%s-%d.%s-%s-%s" $global.Release.Name $global.Chart.Name $global.Values.zookeeper.component $i $global.Release.Name $global.Chart.Name $global.Values.zookeeper.component }}{{ end }}
clusterName: {{ template "pulsar.fullname" . }}
functionsWorkerEnabled: "true"
PF_pulsarFunctionsCluster: {{ template "pulsar.fullname" . }}
{{ toYaml .Values.broker.configData | indent 2 }}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ spec:
command: ["sh", "-c"]
args:
- >-
until nslookup {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ add (.Values.zookeeper.replicaCount | int) -1 }}.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ .Values.namespace }}; do
until bin/pulsar zookeeper-shell -server {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }} ls /admin/clusters/{{ template "pulsar.fullname" . }}; do
sleep 3;
done;
containers:
Expand All @@ -98,6 +98,7 @@ spec:
- >
bin/apply-config-from-env.py conf/broker.conf &&
bin/apply-config-from-env.py conf/pulsar_env.sh &&
bin/gen-yml-from-env.py conf/functions_worker.yml &&
bin/pulsar broker
ports:
- name: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ spec:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-config"
configMap:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}"
{{- if not .Values.prometheus_persistence }}
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}"
emptyDir: {}
{{- end }}
{{- if .Values.prometheus_persistence }}
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}"
persistentVolumeClaim:
claimName: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}"
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ spec:
command: ["sh", "-c"]
args:
- >-
until nslookup {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}-{{ add (.Values.zookeeper.replicaCount | int) -1 }}.{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}.{{ .Values.namespace }}; do
until bin/pulsar zookeeper-shell -server {{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }} ls /admin/clusters/{{ template "pulsar.fullname" . }}; do
sleep 3;
done;
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ metadata:
annotations:
{{ toYaml .Values.proxy.service.annotations | indent 4 }}
spec:
type: NodePort
type: {{ .Values.proxy.service.type }}
ports:
{{ toYaml .Values.proxy.service.ports | indent 2 }}
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ spec:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeperMetadata.component }}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.zookeeper_metadata.resources }}
resources:
{{ toYaml .Values.zookeeper_metadata.resources | indent 10 }}
{{- end }}
command: ["sh", "-c"]
args:
- >
Expand Down
Loading

0 comments on commit 2bc4812

Please sign in to comment.