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
2 changes: 2 additions & 0 deletions doc/ovhcloud_cloud_kube.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Manage Kubernetes clusters in the given cloud project
* [ovhcloud cloud kube edit](ovhcloud_cloud_kube_edit.md) - Edit the given Kubernetes cluster
* [ovhcloud cloud kube get](ovhcloud_cloud_kube_get.md) - Get the given Kubernetes cluster
* [ovhcloud cloud kube ip-restrictions](ovhcloud_cloud_kube_ip-restrictions.md) - Manage IP restrictions for Kubernetes clusters
* [ovhcloud cloud kube k9s](ovhcloud_cloud_kube_k9s.md) - Generate kubeconfig and launch k9s for the given Kubernetes cluster
* [ovhcloud cloud kube kubeconfig](ovhcloud_cloud_kube_kubeconfig.md) - Manage the kubeconfig for the given Kubernetes cluster
* [ovhcloud cloud kube list](ovhcloud_cloud_kube_list.md) - List your Kubernetes clusters
* [ovhcloud cloud kube node](ovhcloud_cloud_kube_node.md) - Manage Kubernetes nodes
Expand All @@ -45,5 +46,6 @@ Manage Kubernetes clusters in the given cloud project
* [ovhcloud cloud kube reset](ovhcloud_cloud_kube_reset.md) - Reset the given Kubernetes cluster
* [ovhcloud cloud kube restart](ovhcloud_cloud_kube_restart.md) - Restart control plane apiserver to invalidate cache without downtime
* [ovhcloud cloud kube set-load-balancers-subnet](ovhcloud_cloud_kube_set-load-balancers-subnet.md) - Update the load balancers subnet ID for the given Kubernetes cluster
* [ovhcloud cloud kube shell](ovhcloud_cloud_kube_shell.md) - Generate kubeconfig and open an interactive shell with kubectl access
* [ovhcloud cloud kube update](ovhcloud_cloud_kube_update.md) - Update the given Kubernetes cluster

1 change: 1 addition & 0 deletions doc/ovhcloud_cloud_kube_ip-restrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Manage IP restrictions for Kubernetes clusters
### SEE ALSO

* [ovhcloud cloud kube](ovhcloud_cloud_kube.md) - Manage Kubernetes clusters in the given cloud project
* [ovhcloud cloud kube ip-restrictions add-my-ip](ovhcloud_cloud_kube_ip-restrictions_add-my-ip.md) - Add your public IP to the cluster's IP restrictions
* [ovhcloud cloud kube ip-restrictions edit](ovhcloud_cloud_kube_ip-restrictions_edit.md) - Edit IP restrictions for the given Kubernetes cluster
* [ovhcloud cloud kube ip-restrictions list](ovhcloud_cloud_kube_ip-restrictions_list.md) - List IP restrictions for the given Kubernetes cluster

41 changes: 41 additions & 0 deletions doc/ovhcloud_cloud_kube_ip-restrictions_add-my-ip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## ovhcloud cloud kube ip-restrictions add-my-ip

Add your public IP to the cluster's IP restrictions

### Synopsis

Automatically detect your public IP address and add it to the cluster's IP restrictions. Requires that IP restrictions are already enabled on the cluster.

```
ovhcloud cloud kube ip-restrictions add-my-ip <cluster_id> [flags]
```

### Options

```
-h, --help help for add-my-ip
```

### Options inherited from parent commands

```
--cloud-project string Cloud project ID
-d, --debug Activate debug mode (will log all HTTP requests details)
-f, --format string Output value according to given format (expression using https://github.com/PaesslerAG/gval syntax)
Examples:
--format 'id' (to extract a single field)
--format 'nested.field.subfield' (to extract a nested field)
--format '[id, 'name']' (to extract multiple fields as an array)
--format '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object)
--format 'name+","+type' (to extract and concatenate fields in a string)
--format '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields)
-e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution
-i, --interactive Interactive output
-j, --json Output in JSON
-y, --yaml Output in YAML
```

### SEE ALSO

* [ovhcloud cloud kube ip-restrictions](ovhcloud_cloud_kube_ip-restrictions.md) - Manage IP restrictions for Kubernetes clusters

41 changes: 41 additions & 0 deletions doc/ovhcloud_cloud_kube_k9s.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## ovhcloud cloud kube k9s

Generate kubeconfig and launch k9s for the given Kubernetes cluster

### Synopsis

Generate kubeconfig, save it to ~/.kube/ovhcloud-<cluster-name>.yaml, and launch k9s with the configuration

```
ovhcloud cloud kube k9s <cluster_id> [flags]
```

### Options

```
-h, --help help for k9s
```

### Options inherited from parent commands

```
--cloud-project string Cloud project ID
-d, --debug Activate debug mode (will log all HTTP requests details)
-f, --format string Output value according to given format (expression using https://github.com/PaesslerAG/gval syntax)
Examples:
--format 'id' (to extract a single field)
--format 'nested.field.subfield' (to extract a nested field)
--format '[id, 'name']' (to extract multiple fields as an array)
--format '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object)
--format 'name+","+type' (to extract and concatenate fields in a string)
--format '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields)
-e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution
-i, --interactive Interactive output
-j, --json Output in JSON
-y, --yaml Output in YAML
```

### SEE ALSO

* [ovhcloud cloud kube](ovhcloud_cloud_kube.md) - Manage Kubernetes clusters in the given cloud project

41 changes: 41 additions & 0 deletions doc/ovhcloud_cloud_kube_shell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## ovhcloud cloud kube shell

Generate kubeconfig and open an interactive shell with kubectl access

### Synopsis

Generate kubeconfig, save it to ~/.kube/ovhcloud-<cluster-name>.yaml, and open a shell with KUBECONFIG set

```
ovhcloud cloud kube shell <cluster_id> [flags]
```

### Options

```
-h, --help help for shell
```

### Options inherited from parent commands

```
--cloud-project string Cloud project ID
-d, --debug Activate debug mode (will log all HTTP requests details)
-f, --format string Output value according to given format (expression using https://github.com/PaesslerAG/gval syntax)
Examples:
--format 'id' (to extract a single field)
--format 'nested.field.subfield' (to extract a nested field)
--format '[id, 'name']' (to extract multiple fields as an array)
--format '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object)
--format 'name+","+type' (to extract and concatenate fields in a string)
--format '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields)
-e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution
-i, --interactive Interactive output
-j, --json Output in JSON
-y, --yaml Output in YAML
```

### SEE ALSO

* [ovhcloud cloud kube](ovhcloud_cloud_kube.md) - Manage Kubernetes clusters in the given cloud project

26 changes: 26 additions & 0 deletions internal/cmd/cloud_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ func initKubeCommand(cloudCmd *cobra.Command) {
ipRestrictionsEditCmd.MarkFlagsMutuallyExclusive("ips", "editor")
ipRestrictionsCmd.AddCommand(ipRestrictionsEditCmd)

ipRestrictionsCmd.AddCommand(&cobra.Command{
Use: "add-my-ip <cluster_id>",
Short: "Add your public IP to the cluster's IP restrictions",
Long: "Automatically detect your public IP address and add it to the cluster's IP restrictions. Requires that IP restrictions are already enabled on the cluster.",
Run: cloud.AddMyIPToKubeRestrictions,
Args: cobra.ExactArgs(1),
})

kubeConfigCmd := &cobra.Command{
Use: "kubeconfig",
Short: "Manage the kubeconfig for the given Kubernetes cluster",
Expand All @@ -133,6 +141,24 @@ func initKubeCommand(cloudCmd *cobra.Command) {
Args: cobra.ExactArgs(1),
})

// k9s command - generate kubeconfig and launch k9s
kubeCmd.AddCommand(&cobra.Command{
Use: "k9s <cluster_id>",
Short: "Generate kubeconfig and launch k9s for the given Kubernetes cluster",
Long: "Generate kubeconfig, save it to ~/.kube/ovhcloud-<cluster-name>.yaml, and launch k9s with the configuration",
Run: cloud.LaunchK9s,
Args: cobra.ExactArgs(1),
})

// shell command - generate kubeconfig and open interactive shell
kubeCmd.AddCommand(&cobra.Command{
Use: "shell <cluster_id>",
Short: "Generate kubeconfig and open an interactive shell with kubectl access",
Long: "Generate kubeconfig, save it to ~/.kube/ovhcloud-<cluster-name>.yaml, and open a shell with KUBECONFIG set",
Run: cloud.LaunchKubeShell,
Args: cobra.ExactArgs(1),
})

nodeCmd := &cobra.Command{
Use: "node",
Short: "Manage Kubernetes nodes",
Expand Down
Loading