Perform a Rollback on a DaemonSet

    You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using or you can use one of these Kubernetes playgrounds:

    Your Kubernetes server must be at or later than version 1.7. To check the version, enter .

    You should already know how to perform a rolling update on a DaemonSet.

    You can skip this step if you only want to roll back to the last revision.

    List all revisions of a DaemonSet:

    1. daemonsets "<daemonset-name>"
    2. REVISION CHANGE-CAUSE
    3. 1 ...
    4. 2 ...
    • Change cause is copied from DaemonSet annotation kubernetes.io/change-cause to its revisions upon creation. You may specify --record=true in to record the command executed in the change cause annotation.

    To see the details of a specific revision:

    1. kubectl rollout history daemonset <daemonset-name> --revision=1

    This returns the details of that revision:

    1. # Specify the revision number you get from Step 1 in --to-revision
    2. kubectl rollout undo daemonset <daemonset-name> --to-revision=<revision>

    If it succeeds, the command returns:

    1. daemonset "<daemonset-name>" rolled back

    Note: If --to-revision flag is not specified, kubectl picks the most recent revision.

    kubectl rollout undo daemonset tells the server to start rolling back the DaemonSet. The real rollback is done asynchronously inside the cluster .

    When the rollback is complete, the output is similar to:

    1. daemonset "<daemonset-name>" successfully rolled out

    In the previous step, you got a list of DaemonSet revisions. Each revision is stored in a resource named ControllerRevision.

    To see what is stored in each revision, find the DaemonSet revision raw resources:

      This returns a list of ControllerRevisions:

      Each ControllerRevision stores the annotations and template of a DaemonSet revision.

      Note: DaemonSet revisions only roll forward. That is to say, after a rollback completes, the revision number (.revision field) of the ControllerRevision being rolled back to will advance. For example, if you have revision 1 and 2 in the system, and roll back from revision 2 to revision 1, the ControllerRevision with .revision: 1 will become .