Kubernetes 复制集连接需要

Kubernetes 复制集连接需要,kubernetes,google-kubernetes-engine,kubernetes-ingress,kubernetes-pod,Kubernetes,Google Kubernetes Engine,Kubernetes Ingress,Kubernetes Pod,目前我正在尝试在kubernetes上设置countly应用程序。 我有一个我不能理解的问题。也许是因为我在里面待的时间太长了,距离不够远 当我的POD(前端和api)计数启动时,我得到以下错误: ERROR [db:read] Error reading apps {"name":"find","args":[{}]} MongoError: seed list contains no mongos proxies, replicaset connections requi

目前我正在尝试在kubernetes上设置countly应用程序。 我有一个我不能理解的问题。也许是因为我在里面待的时间太长了,距离不够远

当我的POD(前端和api)计数启动时,我得到以下错误:

ERROR   [db:read]   Error reading apps {"name":"find","args":[{}]} MongoError: seed list 

    contains no mongos proxies, replicaset connections requires the parameter replicaSet to be supplied in the URI or options object, mongodb://server:port/db?replicaSet=name {"name":"MongoError"}
    No apps to upgrade
我在mongodb网站上查过

在底部,我放置了命令kubectl get all的结果,以查看服务名称和pod名称。 我试过很多不同的方法,但每次我都犯了错误

部署。yaml

# Source: countly-chart/templates/frontend.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: RELEASE-NAME-frontend
  labels:
    name: RELEASE-NAME-frontend
    app: RELEASE-NAME
    product: dgt
    environment: dev
    version: HEAD
    component: frontend
spec:
  replicas: 1
  revisionHistoryLimit: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
  selector:
    matchLabels:
      name: RELEASE-NAME-frontend
      app: RELEASE-NAME
      product: dgt
      environment: dev
      version: HEAD
      component: frontend
  template:
    metadata:
      labels:
        name: RELEASE-NAME-frontend
        app: RELEASE-NAME
        product: dgt
        environment: dev
        version: HEAD
        component: frontend
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: app
                    operator: In
                    values:
                      - mongodb
                      - mongodb
              topologyKey: "kubernetes.io/hostname"
      terminationGracePeriodSeconds: 10
      containers:
        - name: countly-frontend
          image: countly/frontend:19.08.1
          resources:
            limits:
              cpu: 100m
              memory: 512Mi
            requests:
              cpu: 100m
              memory: 512Mi
          imagePullPolicy: Always
          ports:
            - containerPort: 6001
          readinessProbe:
            httpGet:
              path: /ping
              port: 6001
            initialDelaySeconds: 60
            periodSeconds: 10
            timeoutSeconds: 3
          env:
            - name: COUNTLY_PLUGINS
              value: "mobile,web,desktop,density,locale,browser,sources,views,enterpriseinfo,logger,systemlogs,errorlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,assistant,plugin-upload,times-of-day,compliance-hub,video-intelligence-monetization,alerts,onboarding"
            - name: COUNTLY_CONFIG_API_FILESTORAGE
              value: "gridfs"
            - name: COUNTLY_CONFIG_API_MONGODB
              value: "mongodb://mongodb-0.mongodb:27017,mongodb-1.mongodb:27017/countly?replicaSet=rs0"
            - name: COUNTLY_CONFIG_FRONTEND_MONGODB
              value: "mongodb://mongodb-0.mongodb:27017,mongodb-1.mongodb:27017/countly?replicaSet=rs0"
            - name: COUNTLY_CONFIG_HOSTNAME
              value: dgt-iointc-countly.xxx.xx
服务。yaml

# Source: countly-chart/templates/frontend.yaml
apiVersion: v1
kind: Service
metadata:
  name: RELEASE-NAME-frontend
  labels:
    app: RELEASE-NAME
    product: dgt
    environment: dev
    version: HEAD
    component: frontend
spec:
  type: NodePort
  ports:
  - port: 6001
    targetPort: 6001
    protocol: TCP
  selector:
    app: RELEASE-NAME
    component: frontend


ApiVersion: apps/v1
kind: StatefulSet
metadata:
  creationTimestamp: "2020-04-09T15:06:27Z"
  generation: 7
  labels:
    app: mongodb
    component: mongo
    environment: iointc
    product: mongodb
  name: mongodb
  namespace: dgt-iointc
  resourceVersion: "510868664"
  selfLink: /apis/apps/v1/namespaces/dgt-iointc/statefulsets/mongodb
  uid: af9eb929-7a73-11ea-a219-0679473f89f6
spec:
  podManagementPolicy: OrderedReady
  replicas: 2
  revisionHistoryLimit: 1
  selector:
    matchLabels:
      app: mongodb
      component: mongo
  serviceName: mongodb
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: mongodb
        component: mongo
        environment: iointc
        product: mongodb
    spec:
      containers:
      - command:
        - mongod
        - --replSet
        - rs0
        - --bind_ip_all
        env:
        - name: MONGODB_REPLICA_SET_NAME
          value: rs0
        image: docker.xxx.xx/run/mongo:3.6.12
        imagePullPolicy: IfNotPresent
        livenessProbe:
          exec:
            command:
            - mongo
            - --eval
            - db.adminCommand('ping')
          failureThreshold: 3
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 5
        name: mongo
        ports:
        - containerPort: 27017
          protocol: TCP
        readinessProbe:
          exec:
            command:
            - mongo
            - --eval
            - db.adminCommand('ping')
          failureThreshold: 3
          initialDelaySeconds: 5
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1
       resources:
          limits:
            cpu: 500m
            memory: 1000Mi
          requests:
            cpu: 50m
            memory: 1000Mi
        securityContext:
          runAsUser: 999
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /data/db
          name: mongo-storage
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 10
  updateStrategy:
    type: RollingUpdate
  volumeClaimTemplates:
  - metadata:
      creationTimestamp: null
      name: mongo-storage
    spec:
      accessModes:
      - ReadWriteOnce
      dataSource: null
      resources:
        requests:
          storage: 600Mi
      storageClassName: nfs-external
    status:
      phase: Pending
Kubectl全力以赴

NAME                                         READY   STATUS    RESTARTS   AGE
pod/countly-api-7b878d6fc5-ktlmg             0/1     Running   17         46m
pod/countly-frontend-6c4fc86c96-g47hx        0/1     Running   0          39m
pod/mongodb-0                                1/1     Running   0          5h19m
pod/mongodb-1                                1/1     Running   0          5h19m

NAME                            TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
service/countly-api             NodePort    10.80.11.164   <none>        3001:32612/TCP   37h
service/countly-frontend        NodePort    10.80.104.62   <none>        6001:31176/TCP   37h
service/mongodb                 ClusterIP   None           <none>        27017/TCP        18h

NAME                                    DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/countly-api             1         1         1            0           12h
deployment.apps/countly-frontend        1         1         1            0           12h

NAME                                               DESIRED   CURRENT   READY   AGE
replicaset.apps/countly-api-7b878d6fc5             1         1         0       46m
replicaset.apps/countly-frontend-6c4fc86c96        1         1         0       39m

NAME                       DESIRED   CURRENT   AGE
statefulset.apps/mongodb   2         2         18h
名称就绪状态重新启动
pod/countly-api-7b878d6fc5-ktlmg 0/1运行17 46m
pod/countly-frontend-6c4fc86c96-g47hx 0/1运行0.39米
pod/mongodb-0 1/1运行0 5h19m
pod/mongodb-1 1/1运行0 5h19m
名称类型CLUSTER-IP外部IP端口年龄
服务/countly api节点端口10.80.11.164 3001:32612/TCP 37h
服务/countly前端节点端口10.80.104.62 6001:31176/TCP 37h
服务/mongodb ClusterIP None 27017/TCP 18h
名称所需的当前最新可用年龄
deployment.apps/countly-api 1 0 12h
deployment.apps/countly-frontend 1 0 12小时
名称所需的当前就绪年龄
replicaset.apps/countly-api-7b878d6fc5 1 0 46m
replicaset.apps/countly-frontend-6c4fc86c96 1 0 39m
姓名当前年龄
statefulset.apps/mongodb 2 18h

您能否分享
kubectl描述pod/countly-api-7b878d6fc5-ktlmg
kubectl描述countly-frontend-6c4fc86c96-g47hx
?我对这个0/1状态很好奇。为了明确您正在使用的是
GKE
?您能否分享
kubectl描述pod/countly-api-7b878d6fc5-ktlmg
kubectl描述countly-frontend-6c4fc86c96-g47hx
?我对这个0/1状态很好奇。为了清楚起见,您使用的是
GKE