Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mnrgreg/kubectl-node-restart

Krew plugin to restart Kubernetes Nodes sequentially and gracefully
https://github.com/mnrgreg/kubectl-node-restart

cluster kubectl-plugin kubernetes kubernetes-cluster rolling-restart

Last synced: 12 days ago
JSON representation

Krew plugin to restart Kubernetes Nodes sequentially and gracefully

Awesome Lists containing this project

README

        

# kubectl-node-restart

`kubectl-node-restart` is a [kubectl plugin](https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/) that sequentially and gracefully performs a rolling restart of Nodes within a Kubernetes cluster

![using kubectl-node-restart plugin](demo/usage.gif)

# Installing
- install `krew` using instructions [here](https://github.com/kubernetes-sigs/krew#installation)
- run `kubectl krew update`
- run `kubectl krew install node-restart`

![installing kubectl-node-restart plugin](demo/installation.gif)

# Usage

- perform rolling restart of all nodes in a cluster

```bash
kubectl node-restart [--context cluster] all
```

- restart only specific nodes selected through labels

```bash
kubectl node-restart --selector node-role.kubernetes.io/master
```

- execute a command prior to reboot labels

```bash
kubectl node-restart all --command "echo 'hello world'"
```

- perform a dry-run

```bash
kubectl node-restart all --dry-run
```

- restart node(s) without first draining

```bash
kubectl node-restart all --force
```

- add a delay of 120seconds between node restarts

```bash
kubectl node-restart all --sleep 120
```

- Pull the Alpine image from a private registry

```bash
kubectl node-restart all --registry myregistry.local/library/alpine:3.9
```