无法在minikube上部署debezium

smtd7mpg  于 2021-06-07  发布在  Kafka
关注(0)|答案(2)|浏览(406)

我是Kubernetes的新手,我正在尝试将Kafka与debezium和mysql结合起来。我在minikube上成功地部署了kafka和mysql,在minikube上部署了debezium yml之后,它挂起了,根本没有响应,然后我重启了minikube,在运行了所有pod之后minikube又挂起了。下面是我的代码:
Zookeeper服务

apiVersion: v1
kind: Service
metadata:
  name: zoo1
  labels:
    app: zookeeper-1
spec:
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  selector:
    app: zookeeper-1

zookeeper部署:

kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: zookeeper-deployment-1
spec:
  template:
    metadata:
      labels:
        app: zookeeper-1
    spec:
      containers:
      - name: zoo1
        image: debezium/zookeeper
        ports:
        - containerPort: 2181
        env:
        - name: ZOOKEEPER_ID
          value: "1"
        - name: ZOOKEEPER_SERVER_1
          value: zoo1

Kafka服务:

apiVersion: v1
kind: Service
metadata:
  name: kafka-service
  labels:
    name: kafka
spec:
  ports:
  - port: 9092
    name: kafka-port
    protocol: TCP
  selector:
    app: kafka
    id: "1"
  type: NodePort

Kafka部署:

kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: kafka-broker1
spec:
  template:
    metadata:
      labels:
        selector: kafka
        app: kafka
        id: "1"
    spec:
      containers:
      - name: kafka
        image: debezium/kafka
        ports:
        - containerPort: 9092
        env:
        - name: KAFKA_ADVERTISED_PORT
          value: "9092"
        - name: KAFKA_ADVERTISED_HOST_NAME
          value: 192.168.39.47
        - name: KAFKA_ZOOKEEPER_CONNECT
          value: zoo1:2181
        - name: KAFKA_BROKER_ID
          value: "1"
        - name: KAFKA_CREATE_TOPICS
          value: hello-topic:3:3

mysql持久卷:


# application/mysql/mysql-pv.yaml

kind: PersistentVolume
apiVersion: v1
metadata:
  name: mysql-pv-volume
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-pv-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

mysql部署:


# application/mysql/mysql-deployment.yaml

# this command is for mysql client   kubectl run -it --rm --image=debezium/example-mysql --restart=Never mysql-client -- mysql -h mysql -pdebezium

apiVersion: v1
kind: Service
metadata:
  name: mysql
spec:
  ports:
  - port: 3306
  selector:
    app: mysql
  clusterIP: None
---
apiVersion: extensions/v1beta1  # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: mysql
spec:
  selector:
    matchLabels:
      app: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - image: debezium/example-mysql
        name: mysql
        env:
          # Use secret in real usage
        - name: MYSQL_ROOT_PASSWORD
          value: debezium
        - name: MYSQL_USER
          value: mysqluser
        - name: MYSQL_PASSWORD
          value: mysqlpw
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-persistent-storage
        persistentVolumeClaim:
          claimName: mysql-pv-claim

debezium部署:

kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: debezium-connect-source
spec:
  selector:
    matchLabels:
      app: debezium-connect-source
  replicas: 1
  template:
    metadata:
      labels:
        app: debezium-connect-source
    spec:
      terminationGracePeriodSeconds: 30
      containers:
      - name: debezium-connect-source
        image: debezium/connect
        env:
        - name: BOOTSTRAP_SERVERS
          value: kafka-service:9092
        - name: GROUP_ID
          value: "1"
        - name: CONFIG_STORAGE_TOPIC
          value: debezium-connect-source_config
        - name: OFFSET_STORAGE_TOPIC
          value: debezium-connect-source_offset
        ports:
        - containerPort: 8083
          name: dm-c-source

当我部署debezium时,问题就开始了,minikube的React就像

$ kubectl get pods
Unable to connect to the server: net/http: TLS handshake timeout

操作系统:centos
minikube版本:v0.30.0

h9a6wy2h

h9a6wy2h1#

您应该为基于java的pod设置内存限制。旧版本的java会将整个客户机内存视为自己的内存,并且会很高兴地将其完全消耗掉——至少有三个JVM已经启动。

41zrol4v

41zrol4v2#

我相信这是因为minikube启动的vm上的资源短缺。
默认情况下,当您开始使用 minikube start 它只占用2个cpu和2gb的ram从您的系统,并通过查看您的部署( kafka + mysql + debezium )这可能还不够。
您可以通过使用 minikube start 带参数 --cpu 以及 --memory (值应以mb为单位)。
更多信息,你应该做 minikube start -h 我强烈建议,如果你想建立一个繁重的部署,你应该使用更多资源的机器。
希望这有帮助。

相关问题