PaddlePaddle / PaddleCloud

PaddlePaddle Docker images and K8s operators for PaddleOCR/Detection developers to use on public/private cloud.
Apache License 2.0
283 stars 77 forks source link

Deploy cloud 到 Kubernetes时出错 #217

Open Daemon007 opened 7 years ago

Daemon007 commented 7 years ago

执行kubectl create -f cloud_deployment.yaml 报错Error from server(BadRequest): error when creating "/cloud-deployment.yaml": Deployment in version v1beta1 cannot be handled as a Deployment: [pos 316]:json: expect char '"' but got char '8'

请问该如何解决?

yaml配置文件:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: paddle-cloud
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: paddle-cloud
    spec:
      volumes:
      - name: cert-volume
        hostPath:
          path: /home/pcloud/data/certs
      - name: mysql-data
        hostPath:
          path: /home/pcloud/data/mysql
      - name: settings
        hostPath:
          path: /home/pcloud/data/settings.py
      #- name: email-tmp-msg:
      #  hostPath:
      #    path: /home/pcloud/templates/email_confirmation_message.txt
      #- name: email-tmp-subj:
      #  hostPath:
      #    path: /home/pcloud/templates/email_confirmation_subject.txt
      #- name: homepage
      #  hostPath:
      #    path: /home/pcloud/templates/homepage.html
      # - name: data-storage
      #   cephfs:
      #     name: cephfs
      #     monitors: ["172.19.32.166:6789"]
      #     path: "/"
      #     user: "admin"
      #     secretRef:
      #       name: ceph-secret
      containers:
      - name: paddle-cloud
        imagePullPolicy: Always
        image: registry.vm-1:5000/paddlecloud
        volumeMounts:
        - name: cert-volume
          mountPath: /certs
        - name: settings
          mountPath: /pcloud/paddlecloud/settings.py
        # - name: data-storage
        #   mountPath: /pfs
        #- name: homepage
        #  mountPath: /pcloud/paddlecloud/templates/homepage.html
        #- name: email-tmp-msg:
        #  mountPath: /pcloud/paddlecloud/notebook/account/email/email_confirmation_message.txt
        #- name: email-tmp-subj:
        #  mountPath: /pcloud/paddlecloud/notebook/account/email/email_confirmation_subject.txt
        ports:
        - containerPort: 8000
        env:
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: PORT
          value: 8000
#        livenessProbe:
#         httpGet:
#           path: /healthz/
#           port: 8000
#           httpHeaders:
#           - name: User-Agent
#             value: kubernetes-health-check
#         initialDelaySeconds: 3
#         periodSeconds: 5
      - name: mysql
        image: mysql:5.7
        volumeMounts:
        - name: mysql-data
          mountPath: /var/lib/mysql
        env:
          - name: MYSQL_ROOT_PASSWORD
            value: root
      nodeSelector:
        kubernetes.io/hostname: vm-2,vm-3,vm-4
typhoonzero commented 7 years ago

try: value: 8000 -> value: "8000", envs are strings

Daemon007 commented 7 years ago

上面的问题已经解决了:

集群下kubectl get nodes,有3个node,vm-2,vm-3,vm-4 三个节点怎么配置到 下面的nodeSelector?下面的写法提示不符合规则

      nodeSelector:
        kubernetes.io/hostname: vm-2,vm-3,vm-4
typhoonzero commented 7 years ago

nodeSelector目前一台机器就行,使pcloud运行在一台机器上,而且这台机器是准备了cert等文件的即可,如果期望运行多个pcloud,需要把mysql单独成为一个service。

Daemon007 commented 7 years ago

这台机器是可以使master节点吧(master节点是vm-1,不出现在kubectl get nodes结果中)。另外Kubernete没有启用TLS认证,能设置cloud不使用cert认证文件启动吗?

typhoonzero commented 7 years ago
  1. 可以使用master节点,可以使用kubectl uncordon vm-1 开启master调度。

  2. 暂时不支持。