feat(k01): replace strimzi kafka with redpanda
build-and-push-harbor / docker-build-push (push) Waiting to run

This commit is contained in:
zetaloop
2026-05-06 11:03:23 +08:00
parent 1deb5dbdb2
commit 2a02b848ff
5 changed files with 92 additions and 108 deletions
+1 -1
View File
@@ -47,6 +47,6 @@ kubectl -n juwan wait --for=jsonpath='{.status.phase}'=Running mongodbcommunity/
echo kafka echo kafka
kubectl apply -f "${INFRA_DIR}/kafka.yaml" kubectl apply -f "${INFRA_DIR}/kafka.yaml"
kubectl -n kafka wait --for=condition=Ready kafka/juwan-kafka --timeout=900s || true kubectl -n redpanda wait --for=condition=Ready redpanda/juwan-kafka --timeout=900s || true
kubectl get pods -A kubectl get pods -A
+72 -91
View File
@@ -1,102 +1,83 @@
apiVersion: kafka.strimzi.io/v1 apiVersion: cluster.redpanda.com/v1alpha2
kind: KafkaNodePool kind: Redpanda
metadata:
name: controller
namespace: kafka
labels:
strimzi.io/cluster: juwan-kafka
spec:
replicas: 1
roles:
- controller
storage:
type: persistent-claim
size: 1Gi
deleteClaim: false
resources:
requests:
cpu: 30m
memory: 200Mi
limits:
memory: 400Mi
jvmOptions:
-Xms: "128M"
-Xmx: "320M"
---
apiVersion: kafka.strimzi.io/v1
kind: KafkaNodePool
metadata:
name: broker
namespace: kafka
labels:
strimzi.io/cluster: juwan-kafka
spec:
replicas: 1
roles:
- broker
storage:
type: persistent-claim
size: 5Gi
deleteClaim: false
resources:
requests:
cpu: 50m
memory: 350Mi
limits:
memory: 600Mi
jvmOptions:
-Xms: "192M"
-Xmx: "512M"
---
apiVersion: kafka.strimzi.io/v1
kind: Kafka
metadata: metadata:
name: juwan-kafka name: juwan-kafka
namespace: kafka namespace: redpanda
annotations:
strimzi.io/node-pools: enabled
strimzi.io/kraft: enabled
spec: spec:
kafka: chartRef:
version: 4.2.0 chartName: redpanda
metadataVersion: 4.2-IV0 chartVersion: 26.1.3
helmRepositoryName: redpanda
clusterSpec:
image:
tag: v26.1.6
fullnameOverride: juwan-kafka
console:
enabled: false
external:
enabled: false
service:
enabled: false
auth:
sasl:
enabled: false
tls:
enabled: false
listeners: listeners:
- name: plain kafka:
port: 9092 port: 9092
type: internal authenticationMethod: null
tls: false tls:
config: enabled: false
offsets.topic.replication.factor: 1 admin:
transaction.state.log.replication.factor: 1 tls:
transaction.state.log.min.isr: 1 enabled: false
default.replication.factor: 1 rpc:
min.insync.replicas: 1 tls:
entityOperator: enabled: false
topicOperator: http:
resources: enabled: false
requests: schemaRegistry:
cpu: 15m enabled: false
memory: 130Mi storage:
limits: persistentVolume:
memory: 250Mi enabled: true
userOperator: size: 5Gi
resources: storageClass: local-path
requests: resources:
cpu: 15m requests:
memory: 130Mi cpu: 50m
limits: memory: 200Mi
memory: 250Mi limits:
cpu: 500m
memory: 500Mi
statefulset:
replicas: 1
additionalRedpandaCmdFlags:
- --overprovisioned
- --smp=1
- --memory=350M
- --reserve-memory=0M
podTemplate:
spec:
affinity:
podAntiAffinity: null
tuning:
tune_aio_events: false
logging:
logLevel: info
usageStats:
enabled: false
--- ---
apiVersion: kafka.strimzi.io/v1 apiVersion: cluster.redpanda.com/v1alpha2
kind: KafkaTopic kind: Topic
metadata: metadata:
name: email-task name: email-task
namespace: kafka namespace: redpanda
labels:
strimzi.io/cluster: juwan-kafka
spec: spec:
partitions: 1 partitions: 1
replicas: 1 replicationFactor: 1
cluster:
clusterRef:
name: juwan-kafka
+13 -8
View File
@@ -3,7 +3,7 @@ set -euo pipefail
REGISTRY_HOST="registry.juwan.xhttp.zip" REGISTRY_HOST="registry.juwan.xhttp.zip"
CNPG_VERSION="1.29.0" CNPG_VERSION="1.29.0"
STRIMZI_VERSION="1.0.0" REDPANDA_OP_VERSION="v26.1.3"
REDIS_OP_VERSION="0.24.0" REDIS_OP_VERSION="0.24.0"
MONGODB_OP_VERSION="1.8.0" MONGODB_OP_VERSION="1.8.0"
@@ -82,17 +82,22 @@ kubectl apply --server-side --force-conflicts -f \
kubectl -n cnpg-system set resources deploy/cnpg-controller-manager \ kubectl -n cnpg-system set resources deploy/cnpg-controller-manager \
--requests=cpu=30m,memory=40Mi --limits=cpu=200m,memory=200Mi --requests=cpu=30m,memory=40Mi --limits=cpu=200m,memory=200Mi
kubectl create namespace kafka 2>/dev/null || true kubectl create namespace redpanda 2>/dev/null || true
curl -sfL "https://github.com/strimzi/strimzi-kafka-operator/releases/download/${STRIMZI_VERSION}/strimzi-cluster-operator-${STRIMZI_VERSION}.yaml" \
| sed 's/namespace: .*/namespace: kafka/' \
| kubectl apply --server-side --force-conflicts -n kafka -f -
kubectl -n kafka set resources deploy/strimzi-cluster-operator \
--requests=cpu=50m,memory=200Mi --limits=cpu=500m,memory=400Mi
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/ 2>/dev/null || true helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/ 2>/dev/null || true
helm repo add mongodb https://mongodb.github.io/helm-charts 2>/dev/null || true helm repo add mongodb https://mongodb.github.io/helm-charts 2>/dev/null || true
helm repo add redpanda https://charts.redpanda.com 2>/dev/null || true
helm repo update helm repo update
helm upgrade --install redpanda-controller redpanda/operator \
--version "${REDPANDA_OP_VERSION}" \
--namespace redpanda \
--set crds.enabled=true \
--set resources.requests.cpu=30m \
--set resources.requests.memory=50Mi \
--set resources.limits.cpu=100m \
--set resources.limits.memory=128Mi
helm upgrade --install redis-operator ot-helm/redis-operator \ helm upgrade --install redis-operator ot-helm/redis-operator \
--version "${REDIS_OP_VERSION}" \ --version "${REDIS_OP_VERSION}" \
--namespace redis-operator --create-namespace \ --namespace redis-operator --create-namespace \
@@ -111,7 +116,7 @@ helm upgrade --install mongodb-kubernetes mongodb/mongodb-kubernetes \
--set operator.resources.limits.memory=200Mi --set operator.resources.limits.memory=200Mi
kubectl -n cnpg-system rollout status deploy/cnpg-controller-manager --timeout=300s kubectl -n cnpg-system rollout status deploy/cnpg-controller-manager --timeout=300s
kubectl -n kafka rollout status deploy/strimzi-cluster-operator --timeout=300s kubectl -n redpanda rollout status deploy/redpanda-controller --timeout=300s
kubectl -n redis-operator rollout status deploy/redis-operator --timeout=300s kubectl -n redis-operator rollout status deploy/redis-operator --timeout=300s
kubectl -n mongodb-operator rollout status deploy/mongodb-kubernetes-operator --timeout=300s kubectl -n mongodb-operator rollout status deploy/mongodb-kubernetes-operator --timeout=300s
+2 -2
View File
@@ -36,7 +36,7 @@ spec:
name: user-redis name: user-redis
key: password key: password
- name: KAFKA_BROKER - name: KAFKA_BROKER
value: "juwan-kafka-kafka-bootstrap.kafka:9092" value: "juwan-kafka-0.juwan-kafka.redpanda:9092"
resources: resources:
requests: requests:
cpu: 10m cpu: 10m
@@ -89,7 +89,7 @@ spec:
containerPort: 4001 containerPort: 4001
env: env:
- name: KAFKA_BROKER - name: KAFKA_BROKER
value: "juwan-kafka-kafka-bootstrap.kafka:9092" value: "juwan-kafka-0.juwan-kafka.redpanda:9092"
- name: EMAIL_SMTP_HOST - name: EMAIL_SMTP_HOST
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
+4 -6
View File
@@ -14,9 +14,8 @@ kubectl -n juwan delete cluster.postgresql.cnpg.io --all --wait=false 2>/dev/nul
kubectl -n juwan delete redisreplication --all --wait=false 2>/dev/null || true kubectl -n juwan delete redisreplication --all --wait=false 2>/dev/null || true
kubectl -n juwan delete redissentinel --all --wait=false 2>/dev/null || true kubectl -n juwan delete redissentinel --all --wait=false 2>/dev/null || true
kubectl -n juwan delete mongodbcommunity --all --wait=false 2>/dev/null || true kubectl -n juwan delete mongodbcommunity --all --wait=false 2>/dev/null || true
kubectl -n kafka delete kafkatopic --all --wait=false 2>/dev/null || true kubectl -n redpanda delete topic --all --wait=false 2>/dev/null || true
kubectl -n kafka delete kafka --all --wait=false 2>/dev/null || true kubectl -n redpanda delete redpanda --all --wait=false 2>/dev/null || true
kubectl -n kafka delete kafkanodepool --all --wait=false 2>/dev/null || true
echo network echo network
kubectl delete -f "${K01_DIR}/infra/envoy.yaml" --ignore-not-found --wait=false kubectl delete -f "${K01_DIR}/infra/envoy.yaml" --ignore-not-found --wait=false
@@ -27,9 +26,8 @@ sleep 30
echo cleanup orphaned echo cleanup orphaned
kubectl -n juwan delete pod --all --force --grace-period=0 2>/dev/null || true kubectl -n juwan delete pod --all --force --grace-period=0 2>/dev/null || true
kubectl -n juwan delete pvc --all --wait=false 2>/dev/null || true kubectl -n juwan delete pvc --all --wait=false 2>/dev/null || true
kubectl -n kafka delete pod -l strimzi.io/cluster=juwan-kafka --force --grace-period=0 2>/dev/null || true kubectl -n redpanda delete pvc -l app.kubernetes.io/instance=juwan-kafka --wait=false 2>/dev/null || true
kubectl -n kafka delete pvc -l strimzi.io/cluster=juwan-kafka --wait=false 2>/dev/null || true
kubectl get pods,pvc -n juwan kubectl get pods,pvc -n juwan
kubectl get pods,pvc -n kafka kubectl get pods,pvc -n redpanda
kubectl describe node | grep -A 6 Allocated kubectl describe node | grep -A 6 Allocated