-
Notifications
You must be signed in to change notification settings - Fork 46
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
rmannibucau
wants to merge
1
commit into
diennea:master
Choose a base branch
from
rmannibucau:rmannibucau/k8s-skeletons
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
K8s skeleton yamls #696
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
herddb-docker/src/main/kubernetes/samples/bookkeeper/1_bookkeeper.configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
66 changes: 66 additions & 0 deletions
66
herddb-docker/src/main/kubernetes/samples/bookkeeper/2_bookkeeper.daemonset.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
22 changes: 22 additions & 0 deletions
22
herddb-docker/src/main/kubernetes/samples/bookkeeper/3_bookkeeper.service.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
27 changes: 27 additions & 0 deletions
27
herddb-docker/src/main/kubernetes/samples/bookkeeper/4_bookkeeper.deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
envFrom: | ||
- configMapRef: | ||
name: bookie-config |
7 changes: 7 additions & 0 deletions
7
herddb-docker/src/main/kubernetes/samples/herddb/1_herddb.configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
15 changes: 15 additions & 0 deletions
15
herddb-docker/src/main/kubernetes/samples/herddb/2_herddb.persistentvolume.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
11 changes: 11 additions & 0 deletions
11
herddb-docker/src/main/kubernetes/samples/herddb/3_herddb.persistentvolumeclaim.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
46 changes: 46 additions & 0 deletions
46
herddb-docker/src/main/kubernetes/samples/herddb/4_herddb.deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
11 changes: 11 additions & 0 deletions
11
herddb-docker/src/main/kubernetes/samples/herddb/5_herddb.service.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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