Enable HashiCorp Consul maintenance mode.
List Consul nodes.
$ consul members
Node Address Status Type Build Protocol DC Partition Segment consul-1 172.16.148.11:8301 alive server 1.12.2 2 dc-lab-1 default <all> consul-2 172.16.148.12:8301 alive server 1.12.2 2 dc-lab-1 default <all> consul-3 172.16.148.13:8301 alive server 1.12.2 2 dc-lab-1 default <all>
Place a current node into maintenance mode.
consul-2$ consul maint -enable -reason "security update"
Node maintenance is now enabled
Inspect maintenance status on the current node.
consul-2$ consul maint
Node: Name: consul-2 Reason: security update
Inspect maintenance for specific node.
$ curl --silent http://127.0.0.1:8500/v1/health/node/consul-2 | jq .
[ { "Node": "consul-2", "CheckID": "_node_maintenance", "Name": "Node Maintenance Mode", "Status": "critical", "Notes": "security update", "Output": "", "ServiceID": "", "ServiceName": "", "ServiceTags": [], "Type": "maintenance", "Interval": "", "Timeout": "", "ExposedPort": 0, "Definition": {}, "CreateIndex": 228618, "ModifyIndex": 228618 }, { "Node": "consul-2", "CheckID": "serfHealth", "Name": "Serf Health Status", "Status": "passing", "Notes": "", "Output": "Agent alive and reachable", "ServiceID": "", "ServiceName": "", "ServiceTags": [], "Type": "", "Interval": "", "Timeout": "", "ExposedPort": 0, "Definition": {}, "CreateIndex": 9, "ModifyIndex": 2015 } ]
Disable maintenance mode on a current node.
consul-2$ consul maint -disable
Node maintenance is now disabled
Inspect maintenance for specific node.
$ curl --silent http://127.0.0.1:8500/v1/health/node/consul-2 | jq .
[ { "Node": "consul-2", "CheckID": "serfHealth", "Name": "Serf Health Status", "Status": "passing", "Notes": "", "Output": "Agent alive and reachable", "ServiceID": "", "ServiceName": "", "ServiceTags": [], "Type": "", "Interval": "", "Timeout": "", "ExposedPort": 0, "Definition": {}, "CreateIndex": 9, "ModifyIndex": 2015 } ]