Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8s skeleton yamls #696

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## from https://raw.githubusercontent.com/apache/bookkeeper/master/deploy/kubernetes/gke/bookkeeper.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: bookie-config
data:
BK_BOOKIE_EXTRA_OPTS: "\"-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+AggressiveOpts -XX:+DoEscapeAnalysis -XX:ParallelGCThreads=32 -XX:ConcGCThreads=32 -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC -XX:-ResizePLAB\""
BK_bookiePort: "3181"
BK_journalDirectory: "/bookkeeper/data/journal"
BK_ledgerDirectories: "/bookkeeper/data/ledgers"
BK_indexDirectories: "/bookkeeper/data/ledgers"
BK_zkServers: zookeeper
# TODO: Issue 458: https://github.com/apache/bookkeeper/issues/458
#BK_statsProviderClass: org.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## from https://raw.githubusercontent.com/apache/bookkeeper/master/deploy/kubernetes/gke/bookkeeper.yaml

## BookKeeper servers need to access the local disks and the pods
## cannot be moved across different nodes.
## For this reason, we run BK as a daemon set, one for each node in the
## cluster, unless restricted by label selectors
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: bookie
labels:
app: bookkeeper
component: bookie
spec:
template:
metadata:
labels:
app: bookkeeper
component: bookie
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8000"

spec:
containers:
- name: bookie
image: apache/bookkeeper:latest
resources:
requests:
memory: "3Gi"
cpu: "1000m"
limits:
memory: "5Gi"
cpu: "2000m"
command: [ "/bin/bash", "/opt/bookkeeper/entrypoint.sh" ]
args: ["/opt/bookkeeper/bin/bookkeeper", "bookie"]
ports:
- name: client
containerPort: 3181
# we are using `status.hostIP` for the bookie's advertised address. export 3181 as the hostPort,
# so that the containers are able to access the host port
hostPort: 3181
envFrom:
- configMapRef:
name: bookie-config
env:
- name: BK_advertisedAddress
valueFrom:
fieldRef:
fieldPath: status.hostIP


volumeMounts:
- name: journal-disk
mountPath: /bookkeeper/data/journal
- name: ledgers-disk
mountPath: /bookkeeper/data/ledgers

volumes:
# Mount local disks
- name: journal-disk
hostPath:
path: /mnt/disks/ssd0
- name: ledgers-disk
hostPath:
path: /mnt/disks/ssd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## from https://raw.githubusercontent.com/apache/bookkeeper/master/deploy/kubernetes/gke/bookkeeper.yaml

##
## Define the Bookie headless service
## In practice, in this case, it is only useful to have a view of
## all the bookie pods that are present
##
apiVersion: v1
kind: Service
metadata:
name: bookie
labels:
app: bookkeeper
component: bookie
spec:
ports:
- port: 3181
name: server
clusterIP: None
selector:
app: bookkeeper
component: bookie
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## from https://raw.githubusercontent.com/apache/bookkeeper/master/deploy/kubernetes/gke/bookkeeper.yaml

##
## 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: bookkeeper
component: bookkeeper-replication
spec:
containers:
- name: replication-worker
image: apache/bookkeeper:latest
command: [ "/bin/bash", "/opt/bookkeeper/entrypoint.sh" ]
args: ["/opt/bookkeeper/bin/bookkeeper", "autorecovery"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is not needed for demo purposes,
this is a daemon that replicates data in case of lost bookies

if we want to make things simple you can drop this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The templates are not for demo purposes but aims at giving a skeleton for real deployments IMHO.
For demo it is ok to use a plain ServerMain, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it should be better to have it.

We are not using autorecovery in production, as we usually have a small set of bookies and we are running autorecovery only manually and when needed (like when you lose definitively a machine)

so okay to keep this file now
thanks

envFrom:
- configMapRef:
name: bookie-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: herddb-config
data:
herddb_env_http_enable: 'true'
# customize at need
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: herddb-pv-volume
labels:
type: local
spec:
# customize by need/k8s env
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/tmp/minikube/herddb"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: herddb-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: herddb
spec:
selector:
matchLabels:
app: herddb
replicas: 1
template:
metadata:
labels:
app: herddb
spec:
containers:
- envFrom:
- configMapRef:
name: herddb-config
image: 'herddb/herddb-server:latest'
imagePullPolicy: IfNotPresent
name: herddb
ports:
- containerPort: 9485
name: http
- containerPort: 7000
name: database
readinessProbe:
httpGet:
path: /metrics
port: 9485
initialDelaySeconds: 3
periodSeconds: 3
livenessProbe:
httpGet:
path: /metrics
port: 9485
initialDelaySeconds: 3
periodSeconds: 3
volumeMounts:
- mountPath: /data
name: herddb-data
restartPolicy: Always
volumes:
- name: herddb-data
persistentVolumeClaim:
claimName: herddb-pv-claim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: herddb-service
spec:
selector:
app: herddb
ports:
- protocol: TCP
port: 80
targetPort: 9485