How to use

Navigation:  Command Line API > Kdctl utility >

How to use

Previous pageReturn to chapter overviewNext page

Kdctl is an Administrator command line interface tool for KuberDock. This tool provides a set of utilities to manage cluster settings, IP pools, nodes, users and so on:

 

config

Commands for config management

images

Commands for docker images management

ippool

Commands for IP pool management

login

Login to remote server

nodes

Commands for nodes management

pods

Commands for pods management

predefined-apps

Commands for predefined applications

pricing

Commands for pricing management

pstorage

Commands for persistent volumes management

system-settings

Commands for system settings management

users

Commands for users management

 

The actual set of resources can be found at "kdctl --help".

 

Login

 

Using of this tool is started from login:

 

kdctl login

          Username: <enter admin username>

          Password: <enter admin password>

 

Login requests token from KD API and saves it locally under the user directory. Thus login needs to be issued once per system unless you want to switch the account.

 

Each of the resources kdctl supports always provides basic CRUD operation and optionally some resource-specific utilities.

 

 

Config

 

Commands for config management

kdctl config

 

Commands:

 set   Set config value

 show  Show current config

 

IPpool

 

Command used for IP pool management:

kdctl ippool [OPTIONS] COMMAND [ARGS]...

 

Commands:

 create        Create new IP pool

 delete        Delete existing IP pool

 get                Get existing IP pool by network

 list                List all existing IP pools

 update        Update existing IP pool

 

Nodes

 

Usage: kdctl nodes [OPTIONS] COMMAND [ARGS]...

 

The commands for nodes management

 

Options:

 -h, --help  Show this message and exit.

 

Commands:

 check-host  Check hostname

 create      Create new node

 delete      Delete existing node

 get         Get existing node

 list        List existing nodes

 update      Update existing node

 

Domains

 

Usage: kdctl domains [OPTIONS] COMMAND [ARGS]...

 

 Commands for domains management

 

Options:

 -h, --help  Show this message and exit.

 

Commands:

 create  Create new domain

 delete  Delete existing domain

 get     Get existing domain

 list    List all existing domains

 update  Update existing domain

 

Examples:

 

1. Adding the new predefined app to catalog

 

Create PA from yaml template file:

 

kdctl predefined-apps create --file <yaml_template_file> --validate --name <app_name>

 

Show details about PA:

 

kdctl predefined-apps get --name <app_name>

 

2. Create pod on behalf of the user

 

Besides the admin functions, kdctl also allows admin to perform any user action on behalf of specified user. Create pod:

 

kdctl pods create --file <pod spec file> --owner <username>

 

Where <pod spec file> contains a json specification as follows:

 

{

   "kube_type": 1,

   "restartPolicy": "Always",

   "name": "My pod",

   "containers": [

       {

           "kubes": 4,

           "image": "nginx",

           "name": "dss7686nkx",

           "ports": [

               {

                   "containerPort": 80,

                   "hostPort": 80,

                   "isPublic": true,

                   "protocol": "TCP"

               }

           ]

       }

   ]

}

 

List user pods:

 

kdctl pods list --owner <username>

 

Delete user pod:

 

kdctl pods delete --name <pod_name> --owner <username>

 

3. Manage persistent storage on behalf of the user:

 

List PVs:

 

kdctl pstorage list --owner <username>

 

Delete PV:

 

kdctl pstorage delete --id <pv_id> --owner <username>