Files
nplus/ai/jsonl/operations2.jsonl

12 lines
4.3 KiB
Plaintext
Raw Normal View History

2025-01-24 16:18:47 +01:00
{"chapter": "Day 2 Ops: Tips & Tricks", "level": 1, "text": ""}
{"chapter": "Re-Installation, re-using the former volumes", "level": 2, "text": "Whether with or without ArgoCD, the used volumes can be reattached during reinstallation. However, a few steps are required:\n1. **Before** deleting the instance, set the instance volumes to *Retain*:\n```bash\nkubectl get pv | grep Delete | grep demo-argo | cut -d' ' -f1 | xargs -I PV_NAME \\\nkubectl patch pv PV_NAME -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n2. **After** deletion, these volumes will be in *Released* state.\nHere, 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.\n```bash\nkubectl get pv -A | grep Released | grep demo-argo | cut -d' ' -f1 | xargs -I PV_NAME \\\nkubectl patch pv PV_NAME --type json -p '[{\"op\": \"remove\", \"path\": \"/spec/claimRef/uid\"}]'\n```\nNow, 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.\nExample:\n```bash\nhelm upgrade --install demo-argo nplus/instance-argo --version 9.1.1001\n```\nHowever, if you create an instance with a different name, the claimRefs won't match, and new volumes will be generated.\n"}
{"chapter": "Cleanup / Completely remove an instance", "level": 2, "text": "1. **Uninstall** the helm charts\nDeletion is *Cascading*, meaning it deletes everything it installed.\n```bash\nhelm uninstall demo-argo\nhelm uninstall demo\n```\n2. The **configuration** is in the **git** of the Toolbox, and it needs to be removed\n```bash\nkubectl exec --stdin --tty nplus-0 -- rm -rf /conf/demo\nkubectl exec --stdin --tty nplus-0 -- rm -rf /conf/demo-argo\n```\n3. If the volumes were **not** on *Delete* but on *Retain*, they can be deleted:\n```bash\nkubectl get pv -A | grep Released | grep \"demo\" | cut -d' ' -f1 | xargs -n1 kubectl delete pv\n```\nNow you can start over.\n"}
{"chapter": "Working with Persistent Volumes", "level": 2, "text": ""}
{"chapter": "Delete all \"Released\" PV", "level": 3, "text": "```bash\nkubectl get pv -A | grep Released | cut -d' ' -f1 | xargs -n1 kubectl delete pv\n```\n"}
{"chapter": "Delete all \"Available\" PV", "level": 3, "text": "```bash\nkubectl get pv -A | grep Available | cut -d' ' -f1 | xargs -n1 kubectl delete pv\n```\n"}
{"chapter": "Make \"Released\" PVs available again", "level": 3, "text": "1. Switch Delete to Retain:\n```bash\nkubectl get pv | grep Delete | grep demo-argo | cut -d' ' -f1 | xargs -I PV_NAME \\\nkubectl patch pv PV_NAME -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}'\n```\n2. Delete ClaimRef UID\n```bash\nkubectl get pv -A | grep Released | grep demo-argo | cut -d' ' -f1 | xargs -I PV_NAME \\\nkubectl patch pv PV_NAME --type json -p '[{\"op\": \"remove\", \"path\": \"/spec/claimRef/uid\"}]'\n```\n"}
{"chapter": "Monitoring", "level": 2, "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!).\nAs a \"computer,\" FQDN, `<instance>.<service>.<namespace>` can be used, for example, `demo-ha-nappl-0.demo-ha-nappl.lab`.\n"}
{"chapter": "Restart a pod", "level": 2, "text": "A Pod might be stuck and you might need to re-deploy this replicaset.\nThis example restarts the *web* component of instance *empty*:\n```\nkubectl rollout restart $(kubectl get deployment,statefulset -l nplus/component=web,nplus/instance=empty -o name)\n```\nTo restart all replicasets without available pods, use\n```\nkubectl get deployment,statefulset --field-selector=status.availableReplicas=0\n```\n"}
{"chapter": "Delete pending pods to have them re-created by the replicasets", "level": 2, "text": "When a pod gets into pending state forever, that is due to a lack of resources, tolerations or missing PVs.\nYo should correct the cause and then you can simply delete the pod and have it re-created by the RS.\nThis is how you get all pending pods:\n```bash\nkubectl get pods --field-selector status.phase=Pending\n```\nYou can delete all of them by\n```bash\nkubectl delete $(kubectl get pods --field-selector status.phase=Pending -o name)\n```\n"}
{"chapter": "Deleting all jobs", "level": 2, "text": "```bash\nkubectl delete $(kubectl get jobs -o name)\n```\n"}