Installer et configurer OKS CLI

Cette page est à ce jour disponible en anglais uniquement.

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.

  1. (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
  2. To install OKS CLI from the pip package, run the following command:

    $ pip install https://docs.eu-west-2.oks.outscale.com/oks_cli.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.

  1. (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
  2. To install OKS CLI from the pip package, run the following command:

    $ pip install https://docs.eu-west-2.oks.outscale.com/oks_cli.zip

    To exit the virtualenv, type deactivate in your terminal.

Installing OKS CLI on Windows

  1. Install Python 3.11 on your machine:

    1. Download and launch the latest Python installer.

    2. Check the Add Python 3.11 to PATH box.

    3. Click Install Now.

    4. Click Disable path length limit.

  2. In a command prompt, type the following commands:

    $ pip install --upgrade pip
    $ pip install https://docs.eu-west-2.oks.outscale.com/oks_cli.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

  1. Generate the autocompletion file with the following command:

    $ _OKS_CLI_COMPLETE=bash_source oks-cli > $HOME/.oks_cli/completions/oks-cli.bash
  2. 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

  1. Generate the autocompletion file with the following command:

    $ _OKS_CLI_COMPLETE=zsh_source oks-cli > $HOME/.oks_cli/completions/oks-cli.zsh
  2. 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_sourc

    You can also generate the file and place it to the any of the catalogs listed in your echo $fpath output.

Enabling Autocompletion in Fish

Generate the autocompletion file with the following command, placing the resulting file to the fish completion folder:

$ _OKS_CLI_COMPLETE=fish_source oks-cli > $HOME/.config/fish/completions/oks-cli.fish

Setting Your First Profile

You need to add at least one OUTSCALE user profile in order to use OKS CLI. For more information, see: Gérer vos profils avec 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 Gérer vos profils avec OKS CLI.