[ anon70939 @ 29.04.2020. 09:36 ] @
Ne znam gde da stavim pitanje o Kubernetesu, pa ajd ovde posto je EKS u pitanju. Namestam neki matori mongodb u replicaset-u. Da bih mogao kasnije da skaliram po potrebi koristio sam StatefulSet gde pravim template, pa na osnovu njega podizem nove instance. Mountovao sam EFS direktno na kontejnere i svaki kontejner dobije svoj PV. Problem je sto svaki PV dobije neko svoje neko jedinstveno ime Citat: $ kubectl get pv NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE pvc-cb3740fa-8967-11ea-a783-0a29ae2396dc 10Gi RWO Retain Bound mongo/mongo-persistent-storage-mongo-0 aws-efs 16h pvc-cdc6ef83-8967-11ea-a783-0a29ae2396dc 10Gi RWO Retain Bound mongo/mongo-persistent-storage-mongo-1 aws-efs 16h Citat: $ kubectl get pv $ kubectl get pvc -A NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE mongo mongo-persistent-storage-mongo-0 Bound pvc-cb3740fa-8967-11ea-a783-0a29ae2396dc 10Gi RWO aws-efs 16h mongo mongo-persistent-storage-mongo-1 Bound pvc-cdc6ef83-8967-11ea-a783-0a29ae2396dc 10Gi RWO aws-efs 16h Ako sad obrisem ceo stack, ostace mi PV zbog "Reclaim Policy: Retain", sto i zelim. Ali ne znam kako da sa novim stackom iskoristim ponovo isti PV. Ja ako uradim deploy ponovo istog stack-a, on ce kreirati novi PV sa drugacijim imenom. Kako da uradim Reclaim ako je u pitanju template iz statefulset? Nije da mi treba sad u ovom momentu, ali me interesuje ako iskrsne potreba za tim. Ovo mi je stack Code: --- apiVersion: apps/v1beta1 kind: StatefulSet metadata: name: {{ .Release.Name }} namespace: {{ .Values.Namespace }} spec: serviceName: {{ .Release.Name }} replicas: 2 template: metadata: labels: role: {{ .Release.Name }} environment: {{ .Values.Environment }} spec: terminationGracePeriodSeconds: 10 containers: - name: {{ .Release.Name }} image: {{ .Values.Mongo.Image }} command: - mongod - "--replSet" - rs1 - "--bind_ip" - 0.0.0.0 - "--smallfiles" - "--noprealloc" ports: - containerPort: {{ .Values.Mongo.Port }} protocol: TCP volumeMounts: - name: {{ .Release.Name }}-persistent-storage mountPath: /data/db - name: {{ .Release.Name }}-sidecar image: cvallance/mongo-k8s-sidecar env: - name: MONGO_SIDECAR_POD_LABELS value: "role={{ .Release.Name }},environment={{ .Values.Environment }}" - name: KUBERNETES_MONGO_SERVICE_NAME value: "{{ .Release.Name }}" volumeClaimTemplates: - metadata: name: {{ .Release.Name }}-persistent-storage annotations: volume.beta.kubernetes.io/storage-class: aws-efs spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 10Gi |