k8s-infra-cluster/yugabyte/yugabytedb2.yaml
2026-03-25 11:46:39 +01:00

808 lines
50 KiB
YAML

---
# Source: yugabyte/templates/service.yaml
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: yb-master-pdb
labels:
app: "yb-master"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
spec:
maxUnavailable: 0
selector:
matchLabels:
app: "yb-master"
release: "yugabytedb"
---
# Source: yugabyte/templates/service.yaml
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: yb-tserver-pdb
labels:
app: "yb-tserver"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
spec:
maxUnavailable: 0
selector:
matchLabels:
app: "yb-tserver"
release: "yugabytedb"
---
# Source: yugabyte/templates/master-gflags-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: yugabytedb-master-gflags
namespace: "db"
labels:
app: "yb-master"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
type: Opaque
stringData:
server.conf.template: |
--fs_data_dirs=/mnt/disk0,/mnt/disk1
--master_addresses=yb-master-0.yb-masters.${NAMESPACE}.svc.cluster.local:7100
--replication_factor=1
--enable_ysql=true
--master_enable_metrics_snapshotter=true
--metrics_snapshotter_tserver_metrics_whitelist=handler_latency_yb_tserver_TabletServerService_Read_count,handler_latency_yb_tserver_TabletServerService_Write_count,handler_latency_yb_tserver_TabletServerService_Read_sum,handler_latency_yb_tserver_TabletServerService_Write_sum,disk_usage,cpu_usage,node_up
--metric_node_name=${EXPORTED_INSTANCE}
--memory_limit_hard_bytes=1824522240
--stderrthreshold=0
--num_cpus=2
--max_log_size=256
--undefok=num_cpus,enable_ysql
--use_node_hostname_for_local_tserver=true
--rpc_bind_addresses=${HOSTNAME}.yb-masters.${NAMESPACE}.svc.cluster.local
--server_broadcast_addresses=${HOSTNAME}.yb-masters.${NAMESPACE}.svc.cluster.local:7100
--webserver_interface=0.0.0.0
--default_memory_limit_to_ram_ratio=0.85
--max_clock_skew_usec=2000000
--time_source=system
---
# Source: yugabyte/templates/tserver-gflags-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: yugabytedb-tserver-gflags
namespace: "db"
labels:
app: "yb-tserver"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
type: Opaque
stringData:
server.conf.template: |
--fs_data_dirs=/mnt/disk0,/mnt/disk1
--tserver_master_addrs=yb-master-0.yb-masters.${NAMESPACE}.svc.cluster.local:7100
--enable_ysql=true
--pgsql_proxy_bind_address=0.0.0.0:5433
--tserver_enable_metrics_snapshotter=true
--metrics_snapshotter_interval_ms=11000
--metrics_snapshotter_tserver_metrics_whitelist=handler_latency_yb_tserver_TabletServerService_Read_count,handler_latency_yb_tserver_TabletServerService_Write_count,handler_latency_yb_tserver_TabletServerService_Read_sum,handler_latency_yb_tserver_TabletServerService_Write_sum,disk_usage,cpu_usage,node_up
--metric_node_name=${EXPORTED_INSTANCE}
--memory_limit_hard_bytes=3649044480
--stderrthreshold=0
--max_log_size=256
--num_cpus=2
--undefok=num_cpus,enable_ysql
--use_node_hostname_for_local_tserver=true
--cql_proxy_bind_address=0.0.0.0:9042
--rpc_bind_addresses=${HOSTNAME}.yb-tservers.${NAMESPACE}.svc.cluster.local
--server_broadcast_addresses=${HOSTNAME}.yb-tservers.${NAMESPACE}.svc.cluster.local:9100
--webserver_interface=0.0.0.0
--max_clock_skew_usec=2000000
--start_pgsql_proxy=true
--time_source=system
---
# Source: yugabyte/templates/debug_config_map.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: yugabytedb-master-hooks
namespace: "db"
labels:
app: "yb-master"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
data:
yb-master-0-pre_debug_hook.sh: "echo 'hello-from-pre' "
yb-master-0-post_debug_hook.sh: "echo 'hello-from-post' "
---
# Source: yugabyte/templates/debug_config_map.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: yugabytedb-tserver-hooks
namespace: "db"
labels:
app: "yb-tserver"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
data:
yb-tserver-0-pre_debug_hook.sh: "echo 'hello-from-pre' "
yb-tserver-0-post_debug_hook.sh: "echo 'hello-from-post' "
yb-tserver-1-pre_debug_hook.sh: "echo 'hello-from-pre' "
yb-tserver-1-post_debug_hook.sh: "echo 'hello-from-post' "
yb-tserver-2-pre_debug_hook.sh: "echo 'hello-from-pre' "
yb-tserver-2-post_debug_hook.sh: "echo 'hello-from-post' "
yb-tserver-3-pre_debug_hook.sh: "echo 'hello-from-pre' "
yb-tserver-3-post_debug_hook.sh: "echo 'hello-from-post' "
---
# Source: yugabyte/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: "yb-masters"
labels:
app: "yb-master"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
service-type: "headless"
spec:
clusterIP: None
publishNotReadyAddresses: true
ports:
- name: "http-ui"
port: 7000
- name: "tcp-rpc-port"
port: 7100
- name: "yugabyted-ui"
port: 15433
selector:
app: "yb-master"
release: "yugabytedb"
---
# Source: yugabyte/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: "yb-tservers"
labels:
app: "yb-tserver"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
service-type: "headless"
spec:
clusterIP: None
publishNotReadyAddresses: true
ports:
- name: "http-ui"
port: 9000
- name: "http-ycql-met"
port: 12000
- name: "http-yedis-met"
port: 11000
- name: "http-ysql-met"
port: 13000
- name: "tcp-rpc-port"
port: 9100
- name: "tcp-yedis-port"
port: 6379
- name: "tcp-yql-port"
port: 9042
- name: "tcp-ysql-port"
port: 5433
- name: "yugabyted-ui"
port: 15433
selector:
app: "yb-tserver"
release: "yugabytedb"
---
# Source: yugabyte/templates/service.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: "yb-master"
namespace: "db"
labels:
app: "yb-master"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
spec:
serviceName: "yb-masters"
podManagementPolicy: Parallel
replicas: 1
volumeClaimTemplates:
- metadata:
name: datadir0
labels:
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
spec:
accessModes:
- "ReadWriteOnce"
storageClassName: longhorn
resources:
requests:
storage: 10Gi
- metadata:
name: datadir1
labels:
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
spec:
accessModes:
- "ReadWriteOnce"
storageClassName: longhorn
resources:
requests:
storage: 10Gi
updateStrategy:
type: RollingUpdate
rollingUpdate:
partition: 0
selector:
matchLabels:
app: "yb-master"
release: "yugabytedb"
template:
metadata:
annotations:
checksum/gflags: 224fc55da42b7ac090d9c011b9089da1fe1ba40a38edb88e71bbac8460ee14a4
labels:
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
app: "yb-master"
yugabytedUi: "true"
spec: # yb-masters
terminationGracePeriodSeconds: 300
affinity:
# Set the anti-affinity selector scope to YB masters and tservers.
podAntiAffinity: {}
containers:
- name: "yb-master"
image: "yugabytedb/yugabyte:2025.2.2.0-b80"
imagePullPolicy: IfNotPresent
lifecycle:
postStart:
exec:
command:
- "bash"
- "-c"
- >
mkdir -p /mnt/disk0/cores;
mkdir -p /mnt/disk0/yb-data/scripts;
if [ ! -f /mnt/disk0/yb-data/scripts/log_cleanup.sh ]; then
if [ -f /home/yugabyte/bin/log_cleanup.sh ]; then
cp /home/yugabyte/bin/log_cleanup.sh /mnt/disk0/yb-data/scripts;
fi;
fi
livenessProbe:
exec:
command:
- bash
- -v
- -c
- |
echo "disk check at: $(date)" \
| tee "/mnt/disk0/disk.check" "/mnt/disk1/disk.check" \
&& sync "/mnt/disk0/disk.check" "/mnt/disk1/disk.check";
exit_code="$?";
echo "disk check exited with: ${exit_code}";
exit "${exit_code}"
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: YBDEVOPS_CORECOPY_DIR
value: "/mnt/disk0/cores"
resources:
limits:
cpu: "2"
memory: 2Gi
requests:
cpu: "2"
memory: 2Gi
# core dumps are collected to workingDir if
# kernel.core_pattern is set to a relative path like
# core.%e.%p.%t ref:
# https://github.com/yugabyte/charts/issues/11
workingDir: "/mnt/disk0/cores"
command:
- "/sbin/tini"
- "--"
args:
- "/bin/bash"
- "-c"
- |
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
/home/yugabyte/tools/k8s_preflight.py all
fi && \
echo "disk check at: $(date)" \
| tee "/mnt/disk0/disk.check" "/mnt/disk1/disk.check" \
&& sync "/mnt/disk0/disk.check" "/mnt/disk1/disk.check" && \
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
PYTHONUNBUFFERED="true" /home/yugabyte/tools/k8s_preflight.py \
dnscheck \
--addr="${HOSTNAME}.yb-masters.${NAMESPACE}.svc.cluster.local" \
--port="7100"
fi && \
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
PYTHONUNBUFFERED="true" /home/yugabyte/tools/k8s_preflight.py \
dnscheck \
--addr="${HOSTNAME}.yb-masters.${NAMESPACE}.svc.cluster.local:7100" \
--port="7100"
fi && \
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
PYTHONUNBUFFERED="true" /home/yugabyte/tools/k8s_preflight.py \
dnscheck \
--addr="0.0.0.0" \
--port="7000"
fi && \
if [[ -f /home/yugabyte/bin/post_install.sh ]]; then
/home/yugabyte/bin/post_install.sh
fi && \
if [[ -f /home/yugabyte/tools/k8s_parent.py ]]; then
k8s_parent="/home/yugabyte/tools/k8s_parent.py"
else
k8s_parent=""
fi && \
mkdir -p /tmp/yugabyte/master/conf && \
envsubst < /opt/master/conf/server.conf.template > /tmp/yugabyte/master/conf/server.conf && \
exec ${k8s_parent} /home/yugabyte/bin/yb-master \
--flagfile /tmp/yugabyte/master/conf/server.conf
ports:
- containerPort: 7000
name: "http-ui"
- containerPort: 7100
name: "tcp-rpc-port"
- containerPort: 15433
name: "yugabyted-ui"
volumeMounts:
- name: master-gflags
mountPath: /opt/master/conf
- name: debug-hooks-volume
mountPath: /opt/debug_hooks_config
- name: datadir0
mountPath: /mnt/disk0
- name: datadir1
mountPath: /mnt/disk1
- name: yb-cleanup
image: "yugabytedb/yugabyte:2025.2.2.0-b80"
imagePullPolicy: IfNotPresent
env:
- name: USER
value: "yugabyte"
command:
- "/sbin/tini"
- "--"
args:
- "/bin/bash"
- "-c"
- >
while true; do
sleep 3600;
/home/yugabyte/scripts/log_cleanup.sh;
done
volumeMounts:
- name: datadir0
mountPath: /home/yugabyte/
subPath: yb-data
- name: datadir0
mountPath: /var/yugabyte/cores
subPath: cores
resources:
limits:
cpu: "0.25"
memory: 250Mi
requests:
cpu: "0.25"
memory: 250Mi
- name: yugabyted-ui
image: "yugabytedb/yugabyte:2025.2.2.0-b80"
imagePullPolicy: "IfNotPresent"
env:
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: YUGABYTED_UI_K8S
value: "true"
command:
- "/sbin/tini"
- "--"
args:
- "/bin/bash"
- "-c"
- |
while true; do
/home/yugabyte/bin/yugabyted-ui \
-database_host=${HOSTNAME}.yb-masters.${NAMESPACE}.svc.cluster.local \
-bind_address=0.0.0.0 \
-ysql_port=5433 \
-ycql_port=9042 \
-master_ui_port=7000 \
-tserver_ui_port=9000 \
|| echo "ERROR: yugabyted-ui failed. This might be because your yugabyte \
version is older than 2.21.0. If this is the case, set yugabytedUi.enabled to false \
in helm to disable yugabyted-ui, or upgrade to a version 2.21.0 or newer."; \
echo "Attempting restart in 30s."
trap break TERM INT; \
sleep 30s & wait; \
trap - TERM INT;
done \
volumes:
- name: debug-hooks-volume
configMap:
name: yugabytedb-master-hooks
defaultMode: 0755
- name: master-gflags
secret:
secretName: yugabytedb-master-gflags
defaultMode: 0755
---
# Source: yugabyte/templates/service.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: "yb-tserver"
namespace: "db"
labels:
app: "yb-tserver"
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
spec:
serviceName: "yb-tservers"
podManagementPolicy: Parallel
replicas: 4
volumeClaimTemplates:
- metadata:
name: datadir0
labels:
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
spec:
accessModes:
- "ReadWriteOnce"
storageClassName: longhorn
resources:
requests:
storage: 10Gi
- metadata:
name: datadir1
labels:
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
spec:
accessModes:
- "ReadWriteOnce"
storageClassName: longhorn
resources:
requests:
storage: 10Gi
updateStrategy:
type: RollingUpdate
rollingUpdate:
partition: 0
selector:
matchLabels:
app: "yb-tserver"
release: "yugabytedb"
template:
metadata:
annotations:
checksum/gflags: 27c813d11438608b9961f0389ea94f47b32083a9fbdb2bf9e9ae272e2814a337
labels:
heritage: "Helm"
release: "yugabytedb"
chart: "yugabyte"
component: "yugabytedb"
app: "yb-tserver"
yugabytedUi: "true"
spec: # yb-tservers
terminationGracePeriodSeconds: 300
affinity:
# Set the anti-affinity selector scope to YB masters and tservers.
podAntiAffinity: {}
containers:
- name: "yb-tserver"
image: "yugabytedb/yugabyte:2025.2.2.0-b80"
imagePullPolicy: IfNotPresent
lifecycle:
postStart:
exec:
command:
- "bash"
- "-c"
- >
mkdir -p /mnt/disk0/cores;
mkdir -p /mnt/disk0/yb-data/scripts;
if [ ! -f /mnt/disk0/yb-data/scripts/log_cleanup.sh ]; then
if [ -f /home/yugabyte/bin/log_cleanup.sh ]; then
cp /home/yugabyte/bin/log_cleanup.sh /mnt/disk0/yb-data/scripts;
fi;
fi
livenessProbe:
exec:
command:
- bash
- -v
- -c
- |
echo "disk check at: $(date)" \
| tee "/mnt/disk0/disk.check" "/mnt/disk1/disk.check" \
&& sync "/mnt/disk0/disk.check" "/mnt/disk1/disk.check";
exit_code="$?";
echo "disk check exited with: ${exit_code}";
exit "${exit_code}"
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: YBDEVOPS_CORECOPY_DIR
value: "/mnt/disk0/cores"
resources:
limits:
cpu: "2"
memory: 4Gi
requests:
cpu: "2"
memory: 4Gi
# core dumps are collected to workingDir if
# kernel.core_pattern is set to a relative path like
# core.%e.%p.%t ref:
# https://github.com/yugabyte/charts/issues/11
workingDir: "/mnt/disk0/cores"
command:
- "/sbin/tini"
- "--"
args:
- "/bin/bash"
- "-c"
- |
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
/home/yugabyte/tools/k8s_preflight.py all
fi && \
echo "disk check at: $(date)" \
| tee "/mnt/disk0/disk.check" "/mnt/disk1/disk.check" \
&& sync "/mnt/disk0/disk.check" "/mnt/disk1/disk.check" && \
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
PYTHONUNBUFFERED="true" /home/yugabyte/tools/k8s_preflight.py \
dnscheck \
--addr="${HOSTNAME}.yb-tservers.${NAMESPACE}.svc.cluster.local" \
--port="9100"
fi && \
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
PYTHONUNBUFFERED="true" /home/yugabyte/tools/k8s_preflight.py \
dnscheck \
--addr="${HOSTNAME}.yb-tservers.${NAMESPACE}.svc.cluster.local:9100" \
--port="9100"
fi && \
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
PYTHONUNBUFFERED="true" /home/yugabyte/tools/k8s_preflight.py \
dnscheck \
--addr="0.0.0.0" \
--port="9000"
fi && \
if [[ -f /home/yugabyte/bin/post_install.sh ]]; then
/home/yugabyte/bin/post_install.sh
fi && \
if [[ -f /home/yugabyte/tools/k8s_parent.py ]]; then
k8s_parent="/home/yugabyte/tools/k8s_parent.py"
else
k8s_parent=""
fi && \
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
PYTHONUNBUFFERED="true" /home/yugabyte/tools/k8s_preflight.py \
dnscheck \
--addr="0.0.0.0:9042" \
--port="9042"
fi && \
if [ -f /home/yugabyte/tools/k8s_preflight.py ]; then
PYTHONUNBUFFERED="true" /home/yugabyte/tools/k8s_preflight.py \
dnscheck \
--addr="0.0.0.0:5433" \
--port="5433"
fi && \
mkdir -p /tmp/yugabyte/tserver/conf && \
envsubst < /opt/tserver/conf/server.conf.template > /tmp/yugabyte/tserver/conf/server.conf && \
exec ${k8s_parent} /home/yugabyte/bin/yb-tserver \
--flagfile /tmp/yugabyte/tserver/conf/server.conf
ports:
- containerPort: 9000
name: "http-ui"
- containerPort: 12000
name: "http-ycql-met"
- containerPort: 11000
name: "http-yedis-met"
- containerPort: 13000
name: "http-ysql-met"
- containerPort: 9100
name: "tcp-rpc-port"
- containerPort: 6379
name: "tcp-yedis-port"
- containerPort: 9042
name: "tcp-yql-port"
- containerPort: 5433
name: "tcp-ysql-port"
- containerPort: 15433
name: "yugabyted-ui"
volumeMounts:
- name: tserver-tmp
mountPath: /tmp
- name: tserver-gflags
mountPath: /opt/tserver/conf
- name: debug-hooks-volume
mountPath: /opt/debug_hooks_config
- name: datadir0
mountPath: /mnt/disk0
- name: datadir1
mountPath: /mnt/disk1
- name: yb-cleanup
image: "yugabytedb/yugabyte:2025.2.2.0-b80"
imagePullPolicy: IfNotPresent
env:
- name: USER
value: "yugabyte"
command:
- "/sbin/tini"
- "--"
args:
- "/bin/bash"
- "-c"
- >
while true; do
sleep 3600;
/home/yugabyte/scripts/log_cleanup.sh;
done
volumeMounts:
- name: datadir0
mountPath: /home/yugabyte/
subPath: yb-data
- name: datadir0
mountPath: /var/yugabyte/cores
subPath: cores
resources:
limits:
cpu: "0.25"
memory: 250Mi
requests:
cpu: "0.25"
memory: 250Mi
- name: yugabyted-ui
image: "yugabytedb/yugabyte:2025.2.2.0-b80"
imagePullPolicy: "IfNotPresent"
env:
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: YUGABYTED_UI_K8S
value: "true"
command:
- "/sbin/tini"
- "--"
args:
- "/bin/bash"
- "-c"
- |
while true; do
/home/yugabyte/bin/yugabyted-ui \
-database_host=${HOSTNAME}.yb-tservers.${NAMESPACE}.svc.cluster.local \
-bind_address=0.0.0.0 \
-ysql_port=5433 \
-ycql_port=9042 \
-master_ui_port=7000 \
-tserver_ui_port=9000 \
|| echo "ERROR: yugabyted-ui failed. This might be because your yugabyte \
version is older than 2.21.0. If this is the case, set yugabytedUi.enabled to false \
in helm to disable yugabyted-ui, or upgrade to a version 2.21.0 or newer."; \
echo "Attempting restart in 30s."
trap break TERM INT; \
sleep 30s & wait; \
trap - TERM INT;
done \
volumes:
- name: debug-hooks-volume
configMap:
name: yugabytedb-tserver-hooks
defaultMode: 0755
- name: tserver-gflags
secret:
secretName: yugabytedb-tserver-gflags
defaultMode: 0755
- name: tserver-tmp
emptyDir: {}
---
# Source: yugabyte/templates/secrets.yaml
# Create secrets from other namespaces for masters.
---
# Source: yugabyte/templates/secrets.yaml
# Create secrets from other namespaces for tservers.
---
# Source: yugabyte/templates/service-endpoints.yaml
# Services endpoints
---
# Source: yugabyte/templates/service.yaml
---