{
  "name": "kubectl-drain-node",
  "title": "Drain a node",
  "category": "Kubernetes",
  "tags": [
    "kubectl",
    "kubernetes"
  ],
  "version": "1.0.0",
  "date": "2026-10-18",
  "notes": "Initial release.",
  "latest": true,
  "installable": true,
  "url": "https://catalog.dagweave.com/api/v1/items/kubectl-drain-node/1.0.0.json",
  "templateUrl": "https://catalog.dagweave.com/api/v1/items/kubectl-drain-node/1.0.0/template.yaml",
  "entrypoint": "drain",
  "parameters": [
    {
      "name": "node",
      "title": "Node",
      "description": "Name of the node to drain.",
      "type": "string",
      "required": true,
      "example": "ip-10-0-3-17.eu-west-1.compute.internal"
    },
    {
      "name": "delete-emptydir-data",
      "title": "Delete emptydir data",
      "description": "Set to \"true\" to evict pods that keep data in an emptyDir volume, losing that data.",
      "type": "string",
      "required": false,
      "default": "false",
      "enum": [
        "true",
        "false"
      ]
    },
    {
      "name": "ignore-daemonsets",
      "title": "Ignore daemonsets",
      "description": "Set to \"true\" to leave DaemonSet pods in place, which drain refuses to do otherwise.",
      "type": "string",
      "required": false,
      "default": "true",
      "enum": [
        "true",
        "false"
      ]
    },
    {
      "name": "timeout",
      "title": "Timeout",
      "description": "Longest time to wait for the pods to leave, such as 300s or 5m.",
      "type": "string",
      "required": false,
      "default": "300s"
    }
  ],
  "images": [
    {
      "ref": "cgr.dev/chainguard/kubectl@sha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba",
      "repository": "cgr.dev/chainguard/kubectl",
      "tag": "latest-dev",
      "digest": "sha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba"
    }
  ],
  "install": {
    "kubectl": "kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/kubectl-drain-node/1.0.0/template.yaml",
    "argo": "argo template create -n argo https://catalog.dagweave.com/api/v1/items/kubectl-drain-node/1.0.0/template.yaml"
  },
  "template": "apiVersion: argoproj.io/v1alpha1\nkind: WorkflowTemplate\nmetadata:\n  name: kubectl-drain-node\n  labels:\n    dagweave.io/catalog-item: kubectl-drain-node\n  annotations:\n    dagweave.io/catalog-version: \"1.0.0\"\n    dagweave.io/catalog-category: \"Kubernetes\"\nspec:\n  entrypoint: drain\n  templates:\n    - name: drain\n      metadata:\n        annotations:\n          dagweave.io/local-support: unsupported\n          dagweave.io/local-support-reason: \u003e-\n            This step runs kubectl with whatever identity the pod is given. On Dagweave\n            Local that is the default service account of the hidden cluster's argo\n            namespace, which Argo's quick-start install grants create, get and patch on pods\n            and create and get on workflows, and nothing anywhere else. Draining reads and\n            patches nodes, which that account cannot do, so the step fails on a 403 rather\n            than touching anything. The cluster you meant is one this run cannot reach.\n      inputs:\n        parameters:\n          - name: node\n          - name: ignore-daemonsets\n            default: \"true\"\n          - name: delete-emptydir-data\n            default: \"false\"\n          - name: timeout\n            default: \"300s\"\n      retryStrategy:\n        limit: \"2\"\n        retryPolicy: OnError\n        backoff:\n          duration: 10s\n          factor: \"2\"\n          maxDuration: 2m\n      container:\n        # cgr.dev/chainguard/kubectl:latest-dev\n        image: cgr.dev/chainguard/kubectl@sha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba\n        command: [sh, -c]\n        args:\n          - |\n            set -eu\n            set -- \"${NODE}\" --timeout=\"${TIMEOUT}\"\n            if [ \"${IGNORE_DAEMONSETS}\" = \"true\" ]; then set -- \"$@\" --ignore-daemonsets; fi\n            if [ \"${DELETE_EMPTYDIR_DATA}\" = \"true\" ]; then set -- \"$@\" --delete-emptydir-data; fi\n            kubectl drain \"$@\"\n        env:\n          - name: NODE\n            value: \"{{inputs.parameters.node}}\"\n          - name: IGNORE_DAEMONSETS\n            value: \"{{inputs.parameters.ignore-daemonsets}}\"\n          - name: DELETE_EMPTYDIR_DATA\n            value: \"{{inputs.parameters.delete-emptydir-data}}\"\n          - name: TIMEOUT\n            value: \"{{inputs.parameters.timeout}}\"\n        resources:\n          requests:\n            cpu: 50m\n            memory: 64Mi\n          limits:\n            memory: 256Mi\n",
  "templateSha256": "df9a2c8438d3aa28463acd1c39fbdacfcb8ef9e01a1b666df39bb26473eec0a9",
  "source": "https://github.com/dagweave/catalog/tree/67458f74dbbf913b03177f3cefc69424be85eb1d/catalog/kubectl-drain-node",
  "catalogSha": "67458f74dbbf913b03177f3cefc69424be85eb1d"
}
