How to Use

Navigation:  Command Line API >

How to Use

Previous pageReturn to chapter overviewNext page

To start kuberdock-cli program just type kcli. The list of available commands with their descriptions and instructions is presented below.

 

Note:

 

<angle brackets> - denote parameters that are required to complete a command;

[brackets] - denote options that are not required to complete a command.

 

Config options:

 

You can specify config file in each command with the options below or run any kcli command to generate config in user’s home directory (~/.kubecli.conf), which can be edited according to the instructions in How to Set up section. This config will be used as default for this user.

 

Options available in each kcli command:

 

-c, --config

Path to config file (ini format), default path is “~/.kubecli.conf”

-j, --json

Output data in json.

 

Example:

 

kcli -c /etc/mykubecli.conf kuberdock set newpod --image nginx

Config /etc/mykubecli.conf is used to create a pod "newpod" with a container "nginx".

 

Commands:

 

kuberdock

provides KuberDock specific functionality: creating and configuring pods and containers to be transmitted on the server, searching for images;

kubectl

mimics kubernetes ‘kubectl’ functionality

docker

mimics docker functionality

 

To create a pod, first you need to create and set up temporary pod configuration on a local machine, add and configure container images in it, then submit pod configuration to KuberDock and use start and install commands to control pod.

 

Actions for kuberdock: create, delete, describe, drives, forget, image_info, kube-types, list, save, search, set, start, stop

 

For work with temporary pod:

 

create

 

Create new temporary pod.

 

To set up new pod and work with temporary pods use the following commands:

 

kcli [-c config] kuberdock create <POD_NAME>

 

Create a new temporary pod configuration on your local machine with the name you need.

set

 

Configuring a temporary pod.

 

Use the command set <POD_NAME> until container/containers setting is finished. You can not reset parameters of pod after saving it configuration and command kcli kuberdock save <POD_NAME> was executed, as pod data is submitted to KuberDock.

 

To set up pod configuration use options below:

 

kcli [-c config] kuberdock set <POD_NAME> [--kube-type <STRING>]

 

Set pod Kube Type name. If there is a space in Kube Type name, then specify "Kube Type name" in quotes. To see a list of available Kube Types use command kcli kuberdock kube-types.

 

kcli [-c config] kuberdock set <POD_NAME> [--restart-policy <STRING>]

 

Set restart policy for the pod.

 

 

forget

 

Delete temporary pod.

 

Use this command to delete temporary pod from your local machine. Note that all configured containers in that pod will be deleted if using the command without argument <POD_NAME>.

 

kcli [-c config] kuberdock forget <POD_NAME>

list

 

List all temporary pods stored on local machine.

 

kcli [-c config] kuberdock list        

save

 

Send a pod configuration to KuberDock server.

 

kcli [-c config] [-j] kuberdock save <POD_NAME>

 

After you have saved a pod it is no more available in a list of temporary pods.

describe

 

Returns a configuration of a temporary pod.

 

kcli [-c config] [-j] kuberdock describe <POD_NAME>

 

Describes the pod configuration that is not saved and sent to KubeDock server.

kube-types

 

Returns a list of available Kube Types.

 

kcli [-c config] [-j] kuberdock describe <POD_NAME>

 

Describes the pod configuration that is not saved and sent to KubeDock server

 

 

To work with container images and add it to temporary pod:

 

search

 

Allows to search container image at docker hub.

 

kcli [-c config] [-j] kuberdock search <IMAGE_NAME>

 

This command returns a list of founded container images in docker hub. You can set docker hub address in config file (~/.kubecli.conf) in section registry.

image_info

 

Describes specific dockerfile.

 

kcli [-c config] [-j] kuberdock image_info <IMAGE_NAME>

 

This command returns a content in dockerfile of founded container images.

 

kcli [-c config] kuberdock set <POD_NAME> [--container <IMAGE-NAME>]

 

Add specified image to the pod and pull the image configuration file (dockerfile). Container ports and volumes will be added from this file.

 

kcli [-c config] kuberdock set <POD_NAME> [--delete] <IMAGE-NAME> 

 

Delete specified image from the pod.

 

To set up a container added to the temporary pod use the following commands:

 

kcli [-c config] kuberdock set <POD_NAME> [--container <IMAGE-NAME> [--container-port <STRING>]]

 

This command allows to control ports and make them available from the Internet. Note that:

 

To define container port, specify them separated by commas: --container-port 80,8443,22

To specify a pod port which is different from container port, use colon (:) after container port number: --container-port 80,8443:443,22

To make a container port available from the Internet, use plus (+) before port number: --container-port +80,8443:443,22 or --container-port 80,+8443:443,22

To specify protocol for proper container port, use colon (:) after port number: --container-port +80,8443:443,22:udp or --container-port 80,+8443:443:tcp,22

 

kcli [-c config] kuberdock set <POD_NAME> [--container <IMAGE-NAME> [--mount-path <STRING>] [--index <INT>]]

 

This commands allows to control volumes inside the specific container. Change or add container path. Use index, to add and change several container paths.

 

kcli [-c config] kuberdock set <POD_NAME> [--container <IMAGE-NAME> [--kubes <INT>]]

 

This command allows to set limits (number of Kubes) for container:

 

kcli [-c config] kuberdock set <POD_NAME> [--container <IMAGE-NAME> [--env <ENV_NAME>:<ENV_VALUE>,<ENV_NAME>:<ENV_VALUE>,…]]

 

This commands allows to set up environment variables for container, where ENV_NAME - variable name, ENV_VALUE - variable value.

 

kcli kuberdock set <POD_NAME> --container <IMAGE_NAME> --list-env

 

This command allows to return all environment variables that already configured for specific container image.

 

kcli kuberdock set <POD_NAME> --container <IMAGE_NAME> --delete-env <ENV_NAME>

 

This command allows to delete specific environment variable from specific image.

 

kcli [-c config] kuberdock set <POD_NAME> [--container <IMAGE-NAME> -p <STORAGE_NAME>] [--size=<SIZE> --mount-path=<STRING>] 

 

This commands allows to mount persistent storage to specific volume in container. Note that data in persistent storage will not wipe out during pod stop, restart or even delete.

 

 

Use the following commands to control pods statuses in KuberDock:

 

kcli [-c config] [-j] kuberdock start <POD_NAME>

Start specified container.

kcli [-c config] [-j] kuberdock stop <POD_NAME>

Stop the specified container.

kcli [-c config] [-j] kuberdock delete <POD_NAME>

Delete the specified pod.


 

Other commands:

 

drives: command for managing persistent volumes

 

kcli [-c config] [-j] kuberdock drives list

Return a list of persistent volumes.

kcli [-c config] [-j] kuberdock drives add --size <SIZE_IN_GB> <VOLUME_NAME>

Add persistent volume with exact size and name.

Example: kcli kuberdock drives add --size 2 new_volume

kcli [-c config] [-j] kuberdock drives delete <VOLUME_NAME>

Delete persistent volume by name

 

Actions for kubectl:

 

The following commands are available: create, delete, describe, get

 

kcli [-c config] [-j] kubectl create pod -f [FILE_NAME]

create: Create new pod from specification in YAML-formatted file. Specify '-' instead of [FILE_NAME] to pass content via stdin.

Note that we are still on the way to add ability to create and start pod from our YAML-files from github.

.

kcli [-c config] [-j] kubectl delete pod <POD_NAME>

delete: allows to delete pod by name

kcli [-c config] kubectl describe pod <POD_NAME>

describe: print detailed information about pod specified by POD_NAME

kcli [-c config] kubectl get pods [POD_NAME]

get: List all pods or one pod if POD_NAME specified