0

신축성있는 검색 창을 영구적으로 만들어서 배치 또는 포드를 다시 만들 때 데이터가 보존되도록하려고합니다. 탄성 검색은 Graylog2 설정의 일부입니다.Kubernetes Persistent Volume이 GCE에서 작동하지 않습니다

나는 모든 것을 설정 한 후 Graylog에 몇 가지 로그를 보냈고 대시 보드에 표시되는 것을 볼 수있었습니다. 그러나 elasticsearch 포드를 삭제하고 다시 만든 후 모든 데이터가 Graylog 대시 보드에서 손실되었습니다.

저는 GCE를 사용하고 있습니다. 여기

내 지속적인 볼륨 설정입니다 :

kind: PersistentVolume 
apiVersion: v1 
metadata: 
    name: elastic-pv 
    labels: 
    type: gcePD 
spec: 
    capacity: 
    storage: 200Gi 
    accessModes: 
    - ReadWriteOnce 
    gcePersistentDisk: 
    fsType: ext4 
    pdName: elastic-pv-disk 

영구 볼륨 청구 설정 :

apiVersion: extensions/v1beta1 
kind: Deployment 
metadata: 
    name: elastic-deployment 
spec: 
    replicas: 1 
    template: 
    metadata: 
     labels: 
     type: elasticsearch 
    spec: 
     containers: 
     - name: elastic-container 
     image: gcr.io/project/myelasticsearch:v1 
     imagePullPolicy: Always 
     ports: 
     - containerPort: 9300 
      name: first-port 
      protocol: TCP 
     - containerPort: 9200 
      name: second-port 
      protocol: TCP 
     volumeMounts: 
      - name: elastic-pd 
       mountPath: /data/db 
     volumes: 
     - name: elastic-pd 
     persistentVolumeClaim: 
      claimName: elastic-pvc 

출력 kubectl describe pod의 :

여기

kind: PersistentVolumeClaim 
apiVersion: v1 
metadata: 
    name: elastic-pvc 
    labels: 
    type: gcePD 
spec: 
    accessModes: 
    - ReadWriteOnce 
    resources: 
    requests: 
     storage: 200Gi 

및 내 elasticsearch 배포입니다

Name:  elastic-deployment-1423685295-jt6x5 
Namespace: default 
Node:  gke-sd-logger-default-pool-2b3affc0-299k/10.128.0.6 
Start Time: Tue, 09 May 2017 22:59:59 +0500 
Labels:  pod-template-hash=1423685295 
     type=elasticsearch 
Status:  Running 
IP:  10.12.0.11 
Controllers: ReplicaSet/elastic-deployment-1423685295 
Containers: 
    elastic-container: 
    Container ID: docker://8774c747e2a56363f657a583bf5c2234ed2cff64dc21b6319fc53fdc5c1a6b2b 
    Image:  gcr.io/thematic-flash-786/myelasticsearch:v1 
    Image ID:  docker://sha256:7c25be62dbad39c07c413888e275ae419a66070d37e0d98bf5008e15d7720eec 
    Ports:  9300/TCP, 9200/TCP 
    Requests: 
     cpu:  100m 
    State:  Running 
     Started:  Tue, 09 May 2017 23:02:11 +0500 
    Ready:  True 
    Restart Count: 0 
    Volume Mounts: 
     /data/db from elastic-pd (rw) 
     /var/run/secrets/kubernetes.io/serviceaccount from default-token-qtdbb (ro) 
    Environment Variables: <none> 
Conditions: 
    Type  Status 
    Initialized True 
    Ready  True 
    PodScheduled True 
Volumes: 
    elastic-pd: 
    Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) 
    ClaimName: elastic-pvc 
    ReadOnly: false 
    default-token-qtdbb: 
    Type: Secret (a volume populated by a Secret) 
    SecretName: default-token-qtdbb 
QoS Class: Burstable 
Tolerations: <none> 
No events. 
kubectl describe pv

출력 :

Name:  elastic-pv 
Labels:  type=gcePD 
StorageClass: 
Status:  Bound 
Claim:  default/elastic-pvc 
Reclaim Policy: Retain 
Access Modes: RWO 
Capacity: 200Gi 
Message: 
Source: 
    Type: GCEPersistentDisk (a Persistent Disk resource in Google Compute Engine) 
    PDName: elastic-pv-disk 
    FSType: ext4 
    Partition: 0 
    ReadOnly: false 
No events. 

출력 kubectl describe pvc의 : 실제 디스크가 존재

Name:  elastic-pvc 
Namespace: default 
StorageClass: 
Status:  Bound 
Volume:  elastic-pv 
Labels:  type=gcePD 
Capacity: 200Gi 
Access Modes: RWO 
No events. 

확인하는 것이 :

enter image description here

는 이유 영구 볼륨이 될 수 무엇 이

입니다 ~ 아닌 지속성 있는?

+0

두 가지 사항이 떠오릅니다. 'elastic-pv-disk '가 GCP에 이미 존재합니까? 클레임 선택기 (200Gi)와 일치 할 수있는 다른 볼륨이 있습니까? 'kubectl describe ','kubectl describe '및'kubectl describe '의 결과를 보여 주면 도움이 될 것입니다. –

+0

@AndyShinn 업데이트를 살펴보십시오. 나는 머리카락을 꺼내왔다. –

+0

그리고 단 하나의 PV가 있습니다 –

답변

1

공식적인 이미지에서 Elasticsearch 데이터는 이 아니고 /data/db이 아닙니다. 영구 볼륨에 데이터를 저장하는 대신 마운트를 /usr/share/elasticsearch/data으로 업데이트해야하는 것으로 보입니다.