DevOps-with-Kubernetes / examples

Apache License 2.0
25 stars 31 forks source link

es-logging-pv missing #2

Open Naveenramchowdary opened 6 years ago

Naveenramchowdary commented 6 years ago

es-logging-pv.yml . To create persistant volume not mentioned in the elastic search file. Please update

falau commented 6 years ago

Hi @Naveenramchowdary , If you're in chap6, or this one: https://github.com/DevOps-with-Kubernetes/examples/blob/master/chapter6/6-3_efk/elasticsearch/es-logging.yml

Then it actually claims the persistent volume with a PVC here:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: es-logging-pvc
  labels:
    app: es-logging
spec:
  accessModes: [ "ReadWriteOnce" ]
  resources:
    requests:
      storage: 1Gi

Thanks

Naveenramchowdary commented 6 years ago

Yeah i got it but my question is we are going to claim the persistent volume using the Pvc. So where did you created the persistent volume. Actually when i am trying to execute it is throwing error .There is no es-logging-pv.

falau commented 6 years ago

If there is no PV provisioned by the example PVC template, it might be that your cluster doesn't have a default StorageClass. You can check 1) If the DefaultStorageClass flag is enabled at the API Server 2) If there's any valid StorageClass is configured as the default one (an annotation like storageclass.kubernetes.io/is-default-class=true

If you're not going to use the default StorageClass, you can still manually set the storageClassName at the PVC template to request a PV with the given storage class or set the 'selector` label at the PVC template to specify the exact PV to use. However, to provision a PV or create a StorageClass, you have to check your cloud provider to know which options are available. Please go to chap4 for more information on concepts of storages in k8s.

But if you just want to go through this example, you can set the volume at the Pod spec to emptyDir :

...
      volumes:
      - name: es-logging-pv
        emptyDir: {}
...