Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,18 +311,26 @@ Created Kubernetes cluster my-first-cluster
```

#### Scaling the cluster
You can change the total number of nodes in the cluster (obviously 1 is the minimum) live while the cluster is running. It takes the name of the cluster (or the ID) and a parameter of `--nodes` which is the new number of nodes to run
You can change the total number of nodes in the cluster (obviously 1 is the minimum) live while the cluster is running. It takes the name of the cluster (or the ID) and a parameter of `--nodes` which is the new number of nodes to run.

```
civo kubernetes scale my-first-cluster --nodes=4
Kubernetes cluster my-first-cluster will now have 4 nodes
```

#### Recycling cluster nodes
If you need to restart a particular node on your cluster, you can recycle it using the `civo kubernetes recycle` command. This command requires an argument, the cluster ID, as well as an option: the node ID you wish to recycle. You will be able to find out the node IDs of your cluster by using the `cluster show` command.

```bash
civo kubernetes recycle my-first-cluster --node=kube-node-e678
Recycling node kube-node-e678 of cluster my-cluster
```

#### Viewing or Saving the cluster configuration
To output a cluster's configuration information, you can invoke `civo kubernetes config cluster-name`. This will output the `kubeconfig` file to the screen.

You can save a cluster's configuration to your local `~/.kube/config` file. This requires `kubectl` to be installed. Usage:
```
```bash
civo kubernetes config -s my-first-cluster
Saved config to ~/.kube/config
```
Expand Down
13 changes: 13 additions & 0 deletions lib/kubernetes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,19 @@ def scale(id)
end
map "rescale" => "scale"

desc "recycle ID/NAME NODE", "recycle specified node on cluster"
option :node, required: true
def recycle(id)
CivoCLI::Config.set_api_auth
cluster = Finder.detect_cluster(id)
name = cluster.name
cluster.recycle(hostname: options[:node])
puts "Recycling node #{options[:node].colorize(:yellow)} of cluster #{name}"
rescue Flexirest::HTTPException => e
puts e.result.reason.colorize(:red)
exit 1
end

desc "remove ID/NAME", "removes an entire Kubernetes cluster with ID/name entered (use with caution!)"
def remove(id)
CivoCLI::Config.set_api_auth
Expand Down