Installing and Configuring OKS CLI
You can manage your resources on OUTSCALE Kubernetes as a Service (OKS) using OKS CLI, a command-line interface (CLI) developed by 3DS OUTSCALE.
Make sure to use the latest available version.For more information, see the About OKS > Kubernetes Versions Support. |
Installing OKS CLI
Installing OKS CLI on Linux
Before you begin: Make sure Python 3.11, or later, and pip are installed on your machine. |
-
(optional) It is recommended to install OKS CLI and its dependencies in a Python virtual environment (virtualenv) rather than directly on your system. To create a virtualenv, run the following commands:
$ python3 -m venv .venv $ source .venv/bin/activate
-
To install OKS CLI from the pip package, run the following command:
$ pip install https://docs.eu-west-2.oks.outscale.com/oks-cli/oks_cli-latest.zip
To exit the virtualenv, type
deactivate
in your terminal.
Installing OKS CLI on macOS
Before you begin: Make sure Python 3.11, or later, and pip are installed on your machine. |
-
(optional) It is recommended to install OKS CLI and its dependencies in a Python virtual environment (virtualenv) rather than directly on your system. To create a virtualenv, run the following commands:
$ python3 -m venv .venv $ source .venv/bin/activate
-
To install OKS CLI from the pip package, run the following command:
$ pip install https://docs.eu-west-2.oks.outscale.com/oks-cli/oks_cli-latest.zip
To exit the virtualenv, type
deactivate
in your terminal.
Installing OKS CLI on Windows
-
Install Python 3.11 on your machine:
-
Download and launch the latest Python installer.
-
Check the Add Python 3.11 to PATH box.
-
Click Install Now.
-
Click Disable path length limit.
-
-
In a command prompt, type the following commands:
$ pip install --upgrade pip $ pip install https://docs.eu-west-2.oks.outscale.com/oks-cli/oks_cli-latest.zip
OKS CLI is installed.
Installing Kubectl
While the OKS CLI provides the necessary commands for creation and management of the cluster’s Control Plane and Worker Nodes, you should install a kubectl (or any other compatible) tool for your OS in order to manage your cluster’s workloads.
Configuring OKS CLI
Enabling Autocompletion
OKS CLI supports autocompletion for non-dynamic commands, sub-commands, and parameters.
Enabling Autocompletion in Bash
-
Generate the autocompletion file with the following command:
$ _OKS_CLI_COMPLETE=bash_source oks-cli > $HOME/.oks_cli/completions/oks-cli.bash
-
Source the file and add it for automatic sourcing in future sessions:
$ . $HOME/.oks_cli/completions/oks-cli.bash $ echo '. $HOME/.oks_cli/completions/oks-cli.bash' >> $HOME/.bashrc
Enabling Autocompletion in Zsh
-
Generate the autocompletion file with the following command:
$ _OKS_CLI_COMPLETE=zsh_source oks-cli > $HOME/.oks_cli/completions/oks-cli.zsh
-
Source the file and add it for automatic sourcing in future sessions:
$ . $HOME/.oks_cli/completions/oks-cli.zsh $ echo '. $HOME/.oks_cli/completions/oks-cli.zsh' >> $HOME/.zsh_source
You can also generate the file and place it to the any of the catalogs listed in your
echo $fpath
output.
Setting Your First Profile
You need to add at least one OUTSCALE user profile in order to use OKS CLI. For more information, see Managing Your Profiles Using OKS CLI.
Using OKS CLI
To send a request using OKS CLI, you need to specify:
-
The command you want to work with,
-
The sub-command to execute,
-
Any other parameters required by the command.
You can run commands on two full scopes: project
and cluster
. Furthermore, the profile
scope allows you to list and manage OUTSCALE accounts in the $HOME/.oks_cli/config.json
file.
To see all available options, run the fullhelp
command:
$ oks-cli fullhelp
To create your first cluster, run the following command (where xx.xx.xx.xx
is the IP you want to authorize access to the cluster management):
$ oks-cli cluster create --cluster-name my-first-cluster --admin "xx.xx.xx.xx/32"
OKS CLI will check all prerequisites and guide you through the setup process until your cluster is up and running.
Alternatively, you can add the appropriate profiles to OKS CLI manually. For more information, see Managing Your Profiles Using OKS CLI.