Export a live resource as YAML

Current state of the resource without managedFields; a good base for a new manifest

kubectl get deployment/<name> -n <ns> -o yaml

tool
kubectl73 commands
tags
config

More kubectl commands

  • kubectl delete pod <name> -n <ns> --grace-period=0 --force

    Removes a pod stuck in Terminating right away; use with care

  • kubectl cp <ns>/<pod>:/remote/path ./local-path

    Copies a file from a running container to your machine

  • kubectl cordon <node>

    Marks the node as unschedulable, so no new pods start there

  • kubectl drain <node> --ignore-daemonsets --delete-emptydir-data

    Safely evicts all pods from the node before maintenance

  • kubectl edit deployment/<name> -n <ns>

    Opens the resource in $EDITOR and applies the changes when you save

all 73 kubectl commands