chapter: Re-Installation, re-using the former volumes

text:
Whether with or without ArgoCD, the used volumes can be reattached during reinstallation. However, a few steps are required:
1. **Before** deleting the instance, set the instance volumes to *Retain*:
```bash
kubectl get pv | grep Delete | grep demo-argo | cut -d' ' -f1 | xargs -I PV_NAME \
kubectl patch pv PV_NAME -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
```
2. **After** deletion, these volumes will be in *Released* state.
Here, the ID of the old PVC must be deleted, but not the entire Ref, otherwise, the disk cannot be assigned to the instance and service later.
```bash
kubectl get pv -A | grep Released | grep demo-argo | cut -d' ' -f1 | xargs -I PV_NAME \
kubectl patch pv PV_NAME --type json -p '[{"op": "remove", "path": "/spec/claimRef/uid"}]'
```
Now, the volumes are in an *Available* state and still have the *claimRef* of the instance and the component. If you now recreate the instance, these disks/volumes will be correctly reused.
Example:
```bash
helm upgrade --install demo-argo nplus/instance-argo --version 9.1.1001
```
However, if you create an instance with a different name, the claimRefs won't match, and new volumes will be generated.


chapter: Cleanup / Completely remove an instance

text:
1. **Uninstall** the helm charts
Deletion is *Cascading*, meaning it deletes everything it installed.
```bash
helm uninstall demo-argo
helm uninstall demo
```
2. The **configuration** is in the **git** of the Toolbox, and it needs to be removed
```bash
kubectl exec --stdin --tty nplus-0 -- rm -rf /conf/demo
kubectl exec --stdin --tty nplus-0 -- rm -rf /conf/demo-argo
```
3. If the volumes were **not** on *Delete* but on *Retain*, they can be deleted:
```bash
kubectl get pv -A | grep Released | grep "demo" | cut -d' ' -f1 | xargs -n1 kubectl delete pv
```
Now you can start over.


chapter: Delete all "Released" PV

text:
```bash
kubectl get pv -A | grep Released | cut -d' ' -f1 | xargs -n1 kubectl delete pv
```


chapter: Delete all "Available" PV

text:
```bash
kubectl get pv -A | grep Available | cut -d' ' -f1 | xargs -n1 kubectl delete pv
```


chapter: Make "Released" PVs available again

text:
1. Switch Delete to Retain:
```bash
kubectl get pv | grep Delete | grep demo-argo | cut -d' ' -f1 | xargs -I PV_NAME \
kubectl patch pv PV_NAME -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
```
2. Delete ClaimRef UID
```bash
kubectl get pv -A | grep Released | grep demo-argo | cut -d' ' -f1 | xargs -I PV_NAME \
kubectl patch pv PV_NAME --type json -p '[{"op": "remove", "path": "/spec/claimRef/uid"}]'
```


chapter: Monitoring

text:
The Monitoring Console can be configured through the RAP Administrator. For each component to be monitored, an entry needs to be added in a component group (RMS doesn't exist!).
As a "computer," FQDN, `<instance>.<service>.<namespace>` can be used, for example, `demo-ha-nappl-0.demo-ha-nappl.lab`.


chapter: Restart a pod

text:
A Pod might be stuck and you might need to re-deploy this replicaset.
This example restarts the *web* component of instance *empty*:
```
kubectl rollout restart $(kubectl get deployment,statefulset -l nplus/component=web,nplus/instance=empty -o name)
```
To restart all replicasets without available pods, use
```
kubectl get deployment,statefulset --field-selector=status.availableReplicas=0
```


chapter: Delete pending pods to have them re-created by the replicasets

text:
When a pod gets into pending state forever, that is due to a lack of resources, tolerations or missing PVs.
Yo should correct the cause and then you can simply delete the pod and have it re-created by the RS.
This is how you get all pending pods:
```bash
kubectl get pods --field-selector status.phase=Pending
```
You can delete all of them by
```bash
kubectl delete $(kubectl get pods --field-selector status.phase=Pending -o name)
```


chapter: Deleting all jobs

text:
```bash
kubectl delete $(kubectl get jobs -o name)
```