Difference between revisions of "Openebs"
Jump to navigation
Jump to search
| (14 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| + | # OpenEBS | ||
| + | |||
| + | https://openebs.io/docs/concepts/casengines | ||
| + | |||
| + | Mayastor snaps https://github.com/openebs/mayastor/issues/1064 | ||
| + | |||
# Ubuntu Microk8s | # Ubuntu Microk8s | ||
| Line 5: | Line 11: | ||
``` | ``` | ||
sudo systemctl status iscsid | sudo systemctl status iscsid | ||
| − | sudo systemctl enable --now iscsid | + | # sudo systemctl enable --now iscsid |
| + | sudo systemctl status iscsid | grep inactive && sudo systemctl enable --now iscsid | ||
sudo microk8s dns ingress rbac openebs | sudo microk8s dns ingress rbac openebs | ||
watch sudo microk8s kubectl get pod -n openebs | watch sudo microk8s kubectl get pod -n openebs | ||
kubectl patch storageclass openebs-jiva-default -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' | kubectl patch storageclass openebs-jiva-default -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' | ||
kubectl patch storageclass microk8s-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}' | kubectl patch storageclass microk8s-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}' | ||
| + | ``` | ||
| + | |||
| + | nginx-claim-pod-jiva.yaml | ||
| + | ``` | ||
| + | apiVersion: v1 | ||
| + | kind: PersistentVolume | ||
| + | metadata: | ||
| + | name: nginx-pv-volume | ||
| + | labels: | ||
| + | type: local | ||
| + | spec: | ||
| + | storageClassName: openebs-jiva-default | ||
| + | capacity: | ||
| + | storage: 10Gi | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | hostPath: | ||
| + | path: "/mnt/data" | ||
| + | --- | ||
| + | apiVersion: v1 | ||
| + | kind: PersistentVolumeClaim | ||
| + | metadata: | ||
| + | name: nginx-pv-claim | ||
| + | spec: | ||
| + | storageClassName: manual | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | resources: | ||
| + | requests: | ||
| + | storage: 3Gi | ||
| + | --- | ||
| + | apiVersion: v1 | ||
| + | kind: Pod | ||
| + | metadata: | ||
| + | name: nginx-pv-pod | ||
| + | spec: | ||
| + | volumes: | ||
| + | - name: nginx-pv-storage | ||
| + | persistentVolumeClaim: | ||
| + | claimName: nginx-pv-claim | ||
| + | containers: | ||
| + | - name: nginx-pv-container | ||
| + | image: nginx | ||
| + | ports: | ||
| + | - containerPort: 80 | ||
| + | name: "http-server" | ||
| + | volumeMounts: | ||
| + | - mountPath: "/usr/share/nginx/html" | ||
| + | name: nginx-pv-storage | ||
| + | ``` | ||
| + | |||
| + | ``` | ||
| + | k exec -it nginx-pv-pod -- bash -c "echo 'hello there' > /usr/share/nginx/html/index.html" | ||
| + | ``` | ||
| + | |||
| + | deployment-claim-example.yaml | ||
| + | ``` | ||
| + | apiVersion: apps/v1 | ||
| + | kind: Deployment | ||
| + | metadata: | ||
| + | name: busybox | ||
| + | labels: | ||
| + | app: busybox | ||
| + | spec: | ||
| + | replicas: 2 | ||
| + | strategy: | ||
| + | type: RollingUpdate | ||
| + | selector: | ||
| + | matchLabels: | ||
| + | app: busybox | ||
| + | template: | ||
| + | metadata: | ||
| + | labels: | ||
| + | app: busybox | ||
| + | spec: | ||
| + | containers: | ||
| + | - resources: | ||
| + | limits: | ||
| + | cpu: 0.5 | ||
| + | name: busybox | ||
| + | image: busybox | ||
| + | command: ['sh', '-c', 'echo Container 1 is Running ; sleep 3600'] | ||
| + | imagePullPolicy: IfNotPresent | ||
| + | ports: | ||
| + | - containerPort: 3306 | ||
| + | name: busybox | ||
| + | volumeMounts: | ||
| + | - mountPath: /var/lib/mysql | ||
| + | name: demo-vol1 | ||
| + | volumes: | ||
| + | - name: demo-vol1 | ||
| + | persistentVolumeClaim: | ||
| + | claimName: busk-claim-jiva | ||
| + | --- | ||
| + | kind: PersistentVolumeClaim | ||
| + | apiVersion: v1 | ||
| + | metadata: | ||
| + | name: busk-claim-jiva | ||
| + | spec: | ||
| + | storageClassName: openebs-jiva-default | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | resources: | ||
| + | requests: | ||
| + | storage: 5G | ||
| + | --- | ||
| + | apiVersion: v1 | ||
| + | kind: Service | ||
| + | metadata: | ||
| + | name: busybox-mysql | ||
| + | labels: | ||
| + | name: busybox-mysql | ||
| + | spec: | ||
| + | ports: | ||
| + | - port: 3306 | ||
| + | targetPort: 3306 | ||
| + | selector: | ||
| + | name: busybox | ||
| + | ``` | ||
| + | |||
| + | ``` | ||
| + | An example of creating a PersistentVolumeClaim utilizing the openebs-hostpath StorageClass | ||
| + | |||
| + | |||
| + | kind: PersistentVolumeClaim | ||
| + | apiVersion: v1 | ||
| + | metadata: | ||
| + | name: local-hostpath-pvc | ||
| + | spec: | ||
| + | storageClassName: openebs-hostpath | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | resources: | ||
| + | requests: | ||
| + | storage: 5G | ||
| + | |||
| + | |||
| + | |||
| + | ----------------------- | ||
| + | |||
| + | If you are planning to use OpenEBS with multi nodes, you can use the openebs-jiva-default StorageClass. | ||
| + | An example of creating a PersistentVolumeClaim utilizing the openebs-jiva-default StorageClass | ||
| + | |||
| + | |||
| + | kind: PersistentVolumeClaim | ||
| + | apiVersion: v1 | ||
| + | metadata: | ||
| + | name: jiva-volume-claim | ||
| + | spec: | ||
| + | storageClassName: openebs-jiva-default | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | resources: | ||
| + | requests: | ||
| + | storage: 5G | ||
``` | ``` | ||
| Line 27: | Line 189: | ||
# Example | # Example | ||
| + | - https://docs.openebs.io/docs/next/jivaguide.html | ||
- https://openebs.io/blog/provisioning-openebs-jiva-volumes-via-csi/ | - https://openebs.io/blog/provisioning-openebs-jiva-volumes-via-csi/ | ||
| + | |||
| + | # Troubleshooting | ||
| + | |||
| + | - https://docs.openebs.io/v190/docs/next/prerequisites.html#ubuntu | ||
| + | |||
| + | ``` | ||
| + | kubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace --all-namespaces | ||
| + | NAMESPACE LAST SEEN TYPE REASON OBJECT MESSAGE | ||
| + | default 27m Warning OwnerRefInvalidNamespace validatingwebhookconfiguration/openebs-validation-webhook-cfg ownerRef [apps/v1/Deployment, namespace: , name: openebs-admission-server, uid: b0a7a9bd-943a-4bc9-a58c-8addef4b6066] does not exist in namespace "" | ||
| + | ``` | ||
| + | ``` | ||
| + | kubectl get validatingwebhookconfiguration | ||
| + | ``` | ||
| + | |||
| + | |||
| + | |||
| + | # Trash | ||
| + | |||
| + | https://docs.openebs.io/v190/docs/next/troubleshooting.html | ||
| + | ``` | ||
| + | kubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace --all-namespaces | ||
| + | ``` | ||
| + | |||
| + | default 88s Warning OwnerRefInvalidNamespace validatingwebhookconfiguration/openebs-validation-webhook-cfg ownerRef [apps/v1/Deployment, namespace: , name: openebs-admission-server, uid: 6dd64c9a-84a4-4b88-aac6-e5a62865302e] does not exist in namespace "" | ||
| + | ``` | ||
| + | kubectl -n openebs get pods -o name | grep admission-server | xargs kubectl -n openebs delete | ||
| + | ``` | ||
| + | |||
| + | Uninstall or Delete | ||
| + | ``` | ||
| + | helm uninstall --namespace openebs openebs | ||
| + | ``` | ||
| + | # Ref | ||
| + | - https://github.com/openebs/openebs/blob/master/k8s/upgrades/README.md | ||
Latest revision as of 15:57, 3 July 2023
OpenEBS
https://openebs.io/docs/concepts/casengines
Mayastor snaps https://github.com/openebs/mayastor/issues/1064
Ubuntu Microk8s
sudo systemctl status iscsid
# sudo systemctl enable --now iscsid
sudo systemctl status iscsid | grep inactive && sudo systemctl enable --now iscsid
sudo microk8s dns ingress rbac openebs
watch sudo microk8s kubectl get pod -n openebs
kubectl patch storageclass openebs-jiva-default -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
kubectl patch storageclass microk8s-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
nginx-claim-pod-jiva.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: nginx-pv-volume
labels:
type: local
spec:
storageClassName: openebs-jiva-default
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
---
apiVersion: v1
kind: Pod
metadata:
name: nginx-pv-pod
spec:
volumes:
- name: nginx-pv-storage
persistentVolumeClaim:
claimName: nginx-pv-claim
containers:
- name: nginx-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: nginx-pv-storage
k exec -it nginx-pv-pod -- bash -c "echo 'hello there' > /usr/share/nginx/html/index.html"
deployment-claim-example.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: busybox
labels:
app: busybox
spec:
replicas: 2
strategy:
type: RollingUpdate
selector:
matchLabels:
app: busybox
template:
metadata:
labels:
app: busybox
spec:
containers:
- resources:
limits:
cpu: 0.5
name: busybox
image: busybox
command: ['sh', '-c', 'echo Container 1 is Running ; sleep 3600']
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3306
name: busybox
volumeMounts:
- mountPath: /var/lib/mysql
name: demo-vol1
volumes:
- name: demo-vol1
persistentVolumeClaim:
claimName: busk-claim-jiva
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: busk-claim-jiva
spec:
storageClassName: openebs-jiva-default
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5G
---
apiVersion: v1
kind: Service
metadata:
name: busybox-mysql
labels:
name: busybox-mysql
spec:
ports:
- port: 3306
targetPort: 3306
selector:
name: busybox
An example of creating a PersistentVolumeClaim utilizing the openebs-hostpath StorageClass
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: local-hostpath-pvc
spec:
storageClassName: openebs-hostpath
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5G
-----------------------
If you are planning to use OpenEBS with multi nodes, you can use the openebs-jiva-default StorageClass.
An example of creating a PersistentVolumeClaim utilizing the openebs-jiva-default StorageClass
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: jiva-volume-claim
spec:
storageClassName: openebs-jiva-default
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5G
- https://docs.openebs.io/docs/next/faq.html
- https://microk8s.io/docs/addon-openebs
- https://docs.openebs.io/v110/docs/next/jivaguide.html
- https://docs.openebs.io/#:~:text=OpenEBS%20creates%20a%20Micro%2Dservice,%2D%20Mayastor%2C%20cStor%20or%20Jiva.&text=When%20the%20node%20running%20the,data%20copies%20on%20other%20nodes.
- https://docs.openebs.io/docs/next/ugndm.html
- https://www.portainer.io/blog/portainer-on-microk8s-openebs-metallb-and-ingress
- https://docs.openebs.io/docs/next/jivaguide.html#create-a-pool
Example
- https://docs.openebs.io/docs/next/jivaguide.html
- https://openebs.io/blog/provisioning-openebs-jiva-volumes-via-csi/
Troubleshooting
kubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace --all-namespaces NAMESPACE LAST SEEN TYPE REASON OBJECT MESSAGE default 27m Warning OwnerRefInvalidNamespace validatingwebhookconfiguration/openebs-validation-webhook-cfg ownerRef [apps/v1/Deployment, namespace: , name: openebs-admission-server, uid: b0a7a9bd-943a-4bc9-a58c-8addef4b6066] does not exist in namespace ""
kubectl get validatingwebhookconfiguration
Trash
https://docs.openebs.io/v190/docs/next/troubleshooting.html
kubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace --all-namespaces
default 88s Warning OwnerRefInvalidNamespace validatingwebhookconfiguration/openebs-validation-webhook-cfg ownerRef [apps/v1/Deployment, namespace: , name: openebs-admission-server, uid: 6dd64c9a-84a4-4b88-aac6-e5a62865302e] does not exist in namespace ""
kubectl -n openebs get pods -o name | grep admission-server | xargs kubectl -n openebs delete
Uninstall or Delete
helm uninstall --namespace openebs openebs