Skip to content

Commit

Permalink
[documentation][deploy] Update deployment instructions for deploying…
Browse files Browse the repository at this point in the history
… pulsar to minikube (apache#2362)

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

* Enable functions workers
  • Loading branch information
sijie authored and merlimat committed Aug 15, 2018
1 parent f352203 commit c6c7def
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 104 deletions.
44 changes: 44 additions & 0 deletions deployment/kubernetes/generic/admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

apiVersion: v1
kind: Pod
metadata:
name: pulsar-admin
spec:
containers:
- name: pulsar-admin
image: apachepulsar/pulsar:latest
command: ["sh", "-c"]
args:
- >
bin/apply-config-from-env.py conf/client.conf &&
bin/apply-config-from-env.py conf/pulsar_env.sh &&
bin/apply-config-from-env.py conf/pulsar_tools_env.sh &&
sleep 10000000000
envFrom:
- configMapRef:
name: broker-config
env:
- name: webServiceUrl
value: "http://proxy:8080/"
- name: brokerServiceUrl
value: "pulsar://proxy:6650/"
- name: PULSAR_MEM
value: "\"-Xms64m -Xmx128m\""
50 changes: 7 additions & 43 deletions deployment/kubernetes/generic/bookie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ kind: ConfigMap
metadata:
name: bookie-config
data:
PULSAR_MEM: "\" -Xms512m -Xmx512m -XX:MaxDirectMemorySize=1g\""
dbStorage_writeCacheMaxSizeMb: "256" # Write cache size (direct memory)
dbStorage_readAheadCacheMaxSizeMb: "256" # Read cache size (direct memory)
zkServers: zk-0.zookeeper,zk-1.zookeeper,zk-2.zookeeper
PULSAR_MEM: "\" -Xms64m -Xmx256m -XX:MaxDirectMemorySize=256m\""
dbStorage_writeCacheMaxSizeMb: "32" # Write cache size (direct memory)
dbStorage_readAheadCacheMaxSizeMb: "32" # Read cache size (direct memory)
zkServers: zookeeper
statsProviderClass: org.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider
---

Expand All @@ -49,15 +49,15 @@ spec:
component: bookkeeper
# Specify cluster to allow aggregation by cluster in
# the metrics
cluster: us-central
cluster: local
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8000"

spec:
containers:
- name: bookie
image: apachepulsar/pulsar:latest
image: apachepulsar/pulsar-all:latest
command: ["sh", "-c"]
args:
- >
Expand Down Expand Up @@ -89,7 +89,7 @@ spec:
# The first time, initialize BK metadata in zookeeper
# Otherwise ignore error if it's already there
- name: bookie-metaformat
image: apachepulsar/pulsar:latest
image: apachepulsar/pulsar-all:latest
command: ["sh", "-c"]
args:
- >
Expand Down Expand Up @@ -130,39 +130,3 @@ spec:
selector:
app: pulsar
component: bookkeeper

---
##
## Run BookKeeper auto-recovery from a different set of containers
## Auto-Recovery makes sure to restore the replication factor when any bookie
## crashes and it's not recovering on its own.
##
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: bookie-autorecovery
spec:
replicas: 2
template:
metadata:
labels:
app: pulsar
component: bookkeeper-replication
spec:
containers:
- name: replication-worker
image: apachepulsar/pulsar:latest
command: ["sh", "-c"]
args:
- >
bin/apply-config-from-env.py conf/bookkeeper.conf &&
bin/bookkeeper autorecovery
envFrom:
- configMapRef:
name: bookie-config
env:
## Configure for lower mem usage
- name: PULSAR_MEM
value: "\" -Xmx256m \""
- name: PULSAR_GC
value: "\" \""
42 changes: 13 additions & 29 deletions deployment/kubernetes/generic/broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@ metadata:
data:
# Tune for available memory. Increase the heap up to 24G to have
# better GC behavior at high throughput
PULSAR_MEM: "\" -Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g\""
zookeeperServers: zk-0.zookeeper,zk-1.zookeeper,zk-2.zookeeper
configurationStoreServers: zk-0.zookeeper,zk-1.zookeeper,zk-2.zookeeper
clusterName: us-central
PULSAR_MEM: "\" -Xms64m -Xmx128m -XX:MaxDirectMemorySize=128m\""
zookeeperServers: zookeeper
configurationStoreServers: zookeeper
clusterName: local
# change the managed ledger settings if you have more bookies
managedLedgerDefaultEnsembleSize: "1"
managedLedgerDefaultWriteQuorum: "1"
managedLedgerDefaultAckQuorum: "1"
# enable pulsar functions
functionsWorkerEnabled: "true"
PF_pulsarFunctionsCluster: local
---
##
## Broker deployment definition
Expand All @@ -50,12 +57,13 @@ spec:
spec:
containers:
- name: broker
image: apachepulsar/pulsar:latest
image: apachepulsar/pulsar-all:latest
command: ["sh", "-c"]
args:
- >
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:
- containerPort: 8080
Expand Down Expand Up @@ -96,27 +104,3 @@ spec:
component: broker

---

###

apiVersion: v1
kind: Pod
metadata:
name: pulsar-admin
spec:
containers:
- name: pulsar-admin
image: apachepulsar/pulsar:latest
command: ["sh", "-c"]
args:
- >
bin/apply-config-from-env.py conf/client.conf &&
sleep 10000000000
envFrom:
- configMapRef:
name: broker-config
env:
- name: webServiceUrl
value: http://broker:8080/
- name: brokerServiceUrl
value: pulsar://broker:6650/
42 changes: 42 additions & 0 deletions deployment/kubernetes/generic/cluster-metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

apiVersion: batch/v1
kind: Job
metadata:
name: pulsar-cluster-metadata-init
labels:
app: pulsar
component: broker
spec:
template:
spec:
containers:
- name: pulsar-cluster-metadata-init-container
image: apachepulsar/pulsar:latest
command: ["sh", "-c"]
args:
- >
bin/pulsar initialize-cluster-metadata \
--cluster local \
--zookeeper zookeeper \
--configuration-store zookeeper \
--web-service-url http://broker.default.svc.cluster.local:8080/ \
--broker-service-url pulsar://broker.default.svc.cluster.local:6650/ || true;
restartPolicy: Never
26 changes: 15 additions & 11 deletions deployment/kubernetes/generic/monitoring.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ metadata:
app: pulsar
component: prometheus
spec:
type: NodePort
ports:
- port: 9090
name: server
clusterIP: None
- name: prometheus
nodePort: 30003
port: 9090
protocol: TCP
selector:
app: pulsar
component: prometheus
Expand Down Expand Up @@ -144,16 +146,16 @@ metadata:
app: pulsar
component: grafana
spec:
type: NodePort
ports:
- port: 3000
name: server
clusterIP: None
- name: grafana
nodePort: 30004
port: 3000
protocol: TCP
selector:
app: pulsar
component: grafana



---
## Include detailed Pulsar dashboard

Expand Down Expand Up @@ -188,10 +190,12 @@ metadata:
app: pulsar
component: dashboard
spec:
type: NodePort
ports:
- port: 80
name: server
clusterIP: None
- name: dashboard
nodePort: 30005
port: 80
protocol: TCP
selector:
app: pulsar
component: dashboard
12 changes: 6 additions & 6 deletions deployment/kubernetes/generic/proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ kind: ConfigMap
metadata:
name: proxy-config
data:
PULSAR_MEM: "\" -Xms4g -Xmx4g -XX:MaxDirectMemorySize=4g\""
zookeeperServers: zk-0.zookeeper,zk-1.zookeeper,zk-2.zookeeper
configurationStoreServers: zk-0.zookeeper,zk-1.zookeeper,zk-2.zookeeper
clusterName: us-central
PULSAR_MEM: "\" -Xms64m -Xmx128m -XX:MaxDirectMemorySize=128m\""
zookeeperServers: zookeeper
configurationStoreServers: zookeeper
clusterName: local
---
##
## Proxy deployment definition
Expand All @@ -36,7 +36,7 @@ kind: Deployment
metadata:
name: proxy
spec:
replicas: 5
replicas: 2
template:
metadata:
labels:
Expand All @@ -48,7 +48,7 @@ spec:
spec:
containers:
- name: proxy
image: apachepulsar/pulsar:latest
image: apachepulsar/pulsar-all:latest
command: ["sh", "-c"]
args:
- >
Expand Down
2 changes: 1 addition & 1 deletion deployment/kubernetes/generic/zookeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ spec:
topologyKey: "kubernetes.io/hostname"
containers:
- name: zookeeper
image: apachepulsar/pulsar:latest
image: apachepulsar/pulsar-all:latest
command: ["sh", "-c"]
args:
- >
Expand Down
Loading

0 comments on commit c6c7def

Please sign in to comment.