mkcli is a command-line interface (CLI) tool designed to manage CF Kubernetes clusters and their associated resources. It provides a user-friendly way to interact with Kubernetes clusters, allowing users to perform operations such as creating, updating, and deleting clusters, managing node pools, and handling authentication contexts.
- Python 3.12 or higher
- pipx
mkcli can be installed using pipx. To install mkcli, run the following command:
pipx install git+https://github.com/CloudFerro/cf-mkcli.gitNote
pipx will install mkcli in a default location, which is usually /root/.local/bin. Don't forget to add
this directory to your PATH environment variable if it is not already included. You can do it automatically
by using pipx ensurepath command and restarting your terminal.
Now you can run it just with:
mkclior
python -m mkcliRemember, that you can always have a look at commandline help:
mkcli --help
To start using mkcli, you need to setup your connection to Managed Kubernetes. The simplest way of doint it is by command:
mkcli auth init
The app will ask you for all needed information like region and realm on which you want to opeate. You will be asked for providing Managed Kubernetes API key for authorization. You can get one, after logging into your account at ClodFerro's Managed Kubernetes website.
If you want to log out, anc clear all saved auth session data, you can just run:
mkcli auth end
and it will purge all saved credentials and tokens, so you will need to run mkcli auth init again to log in.
Here you can find a several examples of how to use the mkcli tool.
You can list all your clusters by running:
mkcli cluster list
To increase readability you can easily filter the output by using jq command. For example, to list only cluster IDs, names and statuses, you can run:
mkcli cluster list --format json | jq '.items[] | {id, name, status}'```
mkcli flavor list
You should see a list of all available flavors in your region.
By default, you should see an output formatted as table. If you want to see it in JSON format,
you can use the --format option:
mkcli flavors list --format json
mkcli cluster create --master-count 1
Advanced: Auth contexts (you can skip this part of docs if you are not interested in advanced usage)
*Optionally: If you want to use mkcli simultaneously for different accounts, regions or realms
you can use "session contexts" feature.
This allows you to create multiple contexts, each with its own credentials and settings.
mkcli auth context add {context-name}
This command will prompt you to add all needed information, for creating a new context (e.g., realm, region, client secret, etc.).
You can always list, edit, duplicate or delete contexts (see help for mkcli auth context command).
To switch between contexts, you can use:
mkcli auth context switch {context-name}
If you want, you can also list, edit, duplicate or delete contexts (see help for mkcli auth context command).
mkcli - A CLI for managing your Kubernetes clusters
Usage:
$ [OPTIONS] COMMAND [ARGS]...Options:
--verbose--version--install-completion: Install completion for the current shell.--show-completion: Show completion for the current shell, to copy it or customize the installation.--help: Show this message and exit.
Commands:
auth: Manage authentication sessionscluster: Manage Kubernetes clustersnode-pool: Manage Kubernetes cluster's node poolskubernetes-version: Manage Kubernetes versionsflavors: Manage Kubernetes machine specs (flavors)
Manage authentication sessions
Usage:
$ auth [OPTIONS] COMMAND [ARGS]...Options:
--help: Show this message and exit.
Commands:
init: Initialize authentication sessionend: End authentication session and clear saved...token: OpenID token management [BETA]key: MK8s API key managementcontext | ctx: Manage multiple authentication sessions
Initialize authentication session
Usage:
$ auth init [OPTIONS]Options:
--realm TEXT: Realm name [required]--region TEXT: Region name [required]--api-url TEXT: MK8s API URL [required]--help: Show this message and exit.
End authentication session and clear saved tokens
Usage:
$ auth end [OPTIONS]Options:
--help: Show this message and exit.
OpenID token management [BETA]
Usage:
$ auth token [OPTIONS] COMMAND [ARGS]...Options:
--help: Show this message and exit.
Commands:
clear: Clear the current access token from the...refresh: Refresh the current access token from the...show: Show the current access token from the...
Clear the current access token from the authorization session (current context)
Usage:
$ auth token clear [OPTIONS]Options:
--help: Show this message and exit.
Refresh the current access token from the authorization session (current context)
Usage:
$ auth token refresh [OPTIONS]Options:
--help: Show this message and exit.
Show the current access token from the authorization session (current context)
Usage:
$ auth token show [OPTIONS]Options:
--help: Show this message and exit.
MK8s API key management
Usage:
$ auth key [OPTIONS] COMMAND [ARGS]...Options:
--help: Show this message and exit.
Commands:
clear: Clear the current API key from the session...show: Show the current API key from the session...set: Set the current API key for the session...create: Create a new API key
Clear the current API key from the session (current context)
Usage:
$ auth key clear [OPTIONS]Options:
--help: Show this message and exit.
Show the current API key from the session (current context)
Usage:
$ auth key show [OPTIONS]Options:
--help: Show this message and exit.
Set the current API key for the session (current context)
Usage:
$ auth key set [OPTIONS] API_KEYArguments:
API_KEY: API key to set for the current context [required]
Options:
--help: Show this message and exit.
Create a new API key
Usage:
$ auth key create [OPTIONS]Options:
--help: Show this message and exit.
Manage multiple authentication sessions
Usage:
$ auth context | ctx [OPTIONS] COMMAND [ARGS]...Options:
--help: Show this message and exit.
Commands:
show: Show current auth contextlist: Remove given auth context from the catalogueadd: Prompt for new auth context and add it to...delete: emove given auth context from the catalogueduplicate: Duplicate given auth context with a new nameedit: Update given auth contextswitch: Switch to a different auth context
Show current auth context
Usage:
$ auth context | ctx show [OPTIONS]Options:
-f, --format [table|json]: [default: table]--help: Show this message and exit.
Remove given auth context from the catalogue
Usage:
$ auth context | ctx list [OPTIONS]Options:
-f, --format [table|json]: [default: table]--help: Show this message and exit.
Prompt for new auth context and add it to the catalogue
Usage:
$ auth context | ctx add [OPTIONS]Options:
--name TEXT: Name for the new auth context [required]--realm TEXT: Realm for the new auth context [required]--region TEXT: Region for the new auth context [required]--api-url TEXT: MK8s API URL for the new auth context [required]--identity-server TEXT: Identity server URL for the new auth context [default: https://identity.cloudferro.com/auth/]--help: Show this message and exit.
emove given auth context from the catalogue
Usage:
$ auth context | ctx delete [OPTIONS] NAMES...Arguments:
NAMES...: Names of the auth context to delete [required]
Options:
-y, --confirm--help: Show this message and exit.
Duplicate given auth context with a new name
Usage:
$ auth context | ctx duplicate [OPTIONS] CTXArguments:
CTX: Name of the auth context to duplicate [required]
Options:
-n, --name TEXT: Name for the new auth context [required]--help: Show this message and exit.
Update given auth context
Usage:
$ auth context | ctx edit [OPTIONS] CTXArguments:
CTX: Name of the auth context to update [required]
Options:
-n, --name TEXT: New name of the edited auth context--client_id TEXT: New Client ID for the edited auth context--realm TEXT: Realm for the edited auth context--api_url TEXT: API URL for the edited auth context--scope TEXT: Scope for the edited auth context--region TEXT: Region for the edited auth context--identity_server TEXT: Identity server URL for the edited auth context--help: Show this message and exit.
Switch to a different auth context
Usage:
$ auth context | ctx switch [OPTIONS] CTXArguments:
CTX: Name of the auth context to set as current [required]
Options:
--help: Show this message and exit.
Manage Kubernetes clusters
Usage:
$ cluster [OPTIONS] COMMAND [ARGS]...Options:
--help: Show this message and exit.
Commands:
create: Create a new k8s clusterupgrade: Upgrade the cluster with given iddelete: Delete the cluster with given idlist: List all clustersshow: Show cluster detailsget-kubeconfig: Download kube-config.yaml for the cluster
Create a new k8s cluster
Usage:
$ cluster create [OPTIONS]Options:
--name TEXT: Cluster name, if None, generate with petname--kubernetes-version TEXT: Kubernetes version, if None, use default [default: 1.30.10]--master-count INTEGER: Number of master nodes, if None, use default [default: 3]--master-flavor TEXT: Master node flavor name, if None, use default [default: hma.medium]--from-json FROM_JSON: Cluster payload in JSON format, if None, use provided options--dry-run: If True, do not perform any actions, just print the payload--format [table|json]: Output format, either 'table' or 'json' [default: table]--help: Show this message and exit.
Upgrade the cluster with given id
Usage:
$ cluster upgrade [OPTIONS] CLUSTER_ID KUBERNETES_VERSIONArguments:
CLUSTER_ID: Cluster ID [required]KUBERNETES_VERSION: Kubernetes version, if None, use default [required]
Options:
--dry-run: If True, do not perform any actions, just print the payload--help: Show this message and exit.
Delete the cluster with given id
Usage:
$ cluster delete [OPTIONS] CLUSTER_IDArguments:
CLUSTER_ID: Cluster ID [required]
Options:
-y, --confirm--dry-run: If True, do not perform any actions, just print the payload--help: Show this message and exit.
List all clusters
Usage:
$ cluster list [OPTIONS]Options:
--format [table|json]: Output format, either 'table' or 'json' [default: table]--help: Show this message and exit.
Show cluster details
Usage:
$ cluster show [OPTIONS] CLUSTER_IDArguments:
CLUSTER_ID: Cluster ID [required]
Options:
--format [table|json]: Output format, either 'table' or 'json' [default: table]--help: Show this message and exit.
Download kube-config.yaml for the cluster
Usage:
$ cluster get-kubeconfig [OPTIONS] CLUSTER_IDArguments:
CLUSTER_ID: Cluster ID [required]
Options:
--output TEXT: Output file for kube-config, default is 'kube-config.yaml' [default: kube-config.yaml]--dry-run: If True, do not perform any actions, just print the payload--help: Show this message and exit.
Manage Kubernetes cluster's node pools
Usage:
$ node-pool [OPTIONS] COMMAND [ARGS]...Options:
--help: Show this message and exit.
Commands:
create: Create a new node poollist: List all node pools in the clusterupdate: Update the node pool with given idshowdelete: Delete a node pool
Create a new node pool
Usage:
$ node-pool create [OPTIONS] CLUSTER_IDArguments:
CLUSTER_ID: Cluster ID [required]
Options:
--flavor TEXT: Machine flavor for the node pool, if None, use the default flavor [required]--name TEXT: Node pool name, if None, generate with petname--node-count INTEGER: Number of nodes in the pool [default: 0]--min-nodes INTEGER: Minimum number of nodes in the pool [default: 0]--max-nodes INTEGER: Maximum number of nodes in the pool [default: 0]--shared-networks TEXT: List of shared networks for the node pool--autoscale / --no-autoscale: Enable autoscaling for the node pool [default: no-autoscale]--labels _PARSE_LABELS: List of labels in the format 'key=value', e.g. 'env=prod'--taints _PARSE_TAINTS: List of taints in the format 'key=value:effect', e.g. 'key=value:NoSchedule'--from-json FROM_JSON: Node-pool payload in JSON format, if None, use provided options--dry-run: If True, do not perform any actions, just print the payload--format [table|json]: Output format, either 'table' or 'json' [default: table]--help: Show this message and exit.
List all node pools in the cluster
Usage:
$ node-pool list [OPTIONS] CLUSTER_IDArguments:
CLUSTER_ID: Cluster ID to operate on [required]
Options:
--format [table|json]: Output format, either 'table' or 'json' [default: table]--help: Show this message and exit.
Update the node pool with given id
Usage:
$ node-pool update [OPTIONS] CLUSTER_ID NODE_POOL_IDArguments:
CLUSTER_ID: Cluster ID [required]NODE_POOL_ID: Node Pool ID to update [required]
Options:
--node-count INTEGER: Number of nodes in the pool--min-nodes INTEGER: Minimum number of nodes in the pool--max-nodes INTEGER: Maximum number of nodes in the pool--shared-networks TEXT: List of shared networks for the node pool--autoscale / --no-autoscale: Enable autoscaling for the node pool--help: Show this message and exit.
Usage:
$ node-pool show [OPTIONS] CLUSTER_ID NODE_POOL_IDArguments:
CLUSTER_ID: Cluster ID to operate on [required]NODE_POOL_ID: Node pool ID to operate on [required]
Options:
--format [table|json]: Output format, either 'table' or 'json' [default: table]--help: Show this message and exit.
Delete a node pool
Usage:
$ node-pool delete [OPTIONS] CLUSTER_ID NODE_POOL_IDArguments:
CLUSTER_ID: Cluster ID to operate on [required]NODE_POOL_ID: Node pool ID to operate on [required]
Options:
-y, --confirm--dry-run: If True, do not perform any actions, just print the payload--help: Show this message and exit.
Manage Kubernetes versions
Usage:
$ kubernetes-version [OPTIONS] COMMAND [ARGS]...Options:
--help: Show this message and exit.
Commands:
list: List all Kubernetes versions
List all Kubernetes versions
Usage:
$ kubernetes-version list [OPTIONS]Options:
--format [table|json]: Output format, either 'table' or 'json' [default: table]--help: Show this message and exit.
Manage Kubernetes machine specs (flavors)
Usage:
$ flavors [OPTIONS] COMMAND [ARGS]...Options:
--help: Show this message and exit.
Commands:
list: List all available flavors
List all available flavors
Usage:
$ flavors list [OPTIONS]Options:
--format [table|json]: Output format, either 'table' or 'json' [default: table]--help: Show this message and exit.


