0

我有一个使用https://github.com/FoundationDB/fdb-kubernetes-operator的 fdb 集群 ,现在尝试使用 https://github.com/FoundationDB/fdb-document-layer 提升一个pod

结果是 pod 的 CrashLoopBackOff

吊舱说明:

  Name:         fdb-doc-layer-84c4b84595-9rv8c
Namespace:    default
Priority:     0
Node:         faraday/5.188.158.233
Start Time:   Sat, 21 Nov 2020 03:10:06 +0300
Labels:       app=fdb-doc-layer
              pod-template-hash=84c4b84595
Annotations:  cni.projectcalico.org/podIP: 10.1.80.235/32
              cni.projectcalico.org/podIPs: 10.1.80.235/32
Status:       Running
IP:           10.1.80.235
IPs:
  IP:           10.1.80.235
Controlled By:  ReplicaSet/fdb-doc-layer-84c4b84595
Containers:
  fdb-doc-layer:
    Container ID:   containerd://86f599ef8bd0684023a093f0e725fde02ac60f3899681053857e411b7c8c4b3b
    Image:          foundationdb/fdb-document-layer-build:latest
    Image ID:       docker.io/foundationdb/fdb-document-layer-build@sha256:5d1e84c5954141ce67be3fa28a428f572c3d8bbff1541ec8588fe82da600cb97
    Port:           27017/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Sat, 21 Nov 2020 03:36:23 +0300
      Finished:     Sat, 21 Nov 2020 03:36:23 +0300
    Ready:          False
    Restart Count:  10
    Limits:
      cpu:     200m
      memory:  128Mi
    Requests:
      cpu:     200m
      memory:  128Mi
    Environment:
      FDB_CLUSTER_FILE:  /etc/foundationdb/fdb.cluster
    Mounts:
      /etc/foundationdb from config-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-mf8pp (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  config-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      sample-cluster-config
    Optional:  false
  default-token-mf8pp:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-mf8pp
    Optional:    false
QoS Class:       Guaranteed
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                   From               Message
  ----     ------     ----                  ----               -------
  Normal   Scheduled  28m                   default-scheduler  Successfully assigned default/fdb-doc-layer-84c4b84595-9rv8c to faraday
  Normal   Pulled     28m                   kubelet            Successfully pulled image "foundationdb/fdb-document-layer-build:latest" in 1.421941982s
  Normal   Pulled     28m                   kubelet            Successfully pulled image "foundationdb/fdb-document-layer-build:latest" in 1.223503462s
  Normal   Pulled     27m                   kubelet            Successfully pulled image "foundationdb/fdb-document-layer-build:latest" in 1.253710381s
  Normal   Pulled     27m                   kubelet            Successfully pulled image "foundationdb/fdb-document-layer-build:latest" in 1.672481437s
  Normal   Created    27m (x4 over 28m)     kubelet            Created container fdb-doc-layer
  Normal   Started    27m (x4 over 28m)     kubelet            Started container fdb-doc-layer
  Normal   Pulling    26m (x5 over 28m)     kubelet            Pulling image "foundationdb/fdb-document-layer-build:latest"
  Normal   Pulled     26m                   kubelet            Successfully pulled image "foundationdb/fdb-document-layer-build:latest" in 1.270867366s
  Warning  BackOff    3m2s (x116 over 28m)  kubelet            Back-off restarting failed container

我的部署.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: fdb-doc-layer
spec:
  replicas: 1
  selector:
    matchLabels:
      app: fdb-doc-layer
  template:
    metadata:
      labels:
        app: fdb-doc-layer
    spec:
      containers:
      - name: fdb-doc-layer
        image: foundationdb/fdb-document-layer-build:latest
        env:
        - name: FDB_CLUSTER_FILE
          value: /etc/foundationdb/fdb.cluster
        volumeMounts:
        - name: config-volume
          mountPath: /etc/foundationdb
        resources:
          limits:
            memory: "128Mi"
            cpu: "200m"
        ports:
        - containerPort: 27017
      volumes:
       - name: config-volume
         configMap:
           name: sample-cluster-config  

如何使 fdb-document-layer 与 kubernetes 一起工作?

4

1 回答 1

1

有两个问题:

  1. 您使用了错误的图像,而不是foundationdb/fdb-document-layer-build:latest应该使用foundationdb/fdb-document-layer:latest. 第一个图像仅用于构建文档层。
  2. ConfigMap 包含fdb.cluster键下的文件,cluster-file因此您需要重新映射它或调整 env 变量。

以下配置有效:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: fdb-doc-layer
spec:
  replicas: 1
  selector:
    matchLabels:
      app: fdb-doc-layer
  template:
    metadata:
      labels:
        app: fdb-doc-layer
    spec:
      containers:
      - name: fdb-doc-layer
        image: foundationdb/fdb-document-layer:latest
        env:
        - name: FDB_CLUSTER_FILE
          value: /etc/foundationdb/fdb.cluster
        volumeMounts:
        - name: config-volume
          mountPath: /etc/foundationdb
        resources:
          limits:
            memory: "128Mi"
            cpu: "200m"
        ports:
        - containerPort: 27017
      volumes:
       - name: config-volume
         configMap:
           name: sample-cluster-config
           items:
           - key: cluster-file
             path: fdb.cluster
于 2020-11-22T12:26:34.733 回答