Commands
3 minute read
KubeOps kubeopsctl
This documentation shows all features of kubeopsctl and how to use these features.
The kosi software must be installed from the start.
General commands
Overview of all KUBEOPSCTL commands
Usage:
kubeopsctl [command] [options]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
apply Use the apply command to apply a specific config to create or modify the cluster.
change change
drain <argument> Drain Command.
uncordon <name> Uncordon Command.
upgrade <name> upgrade Command.
status <name> Status Command.
Command ‘kubeopsctl –version’
The kubeopsctl --version command shows you the current version of kubeopsctl.
kubeopsctl --version
The output should be:
0.2.0-Alpha0
Command ‘kubeopsctl –help’
The command kubeopsctl --help gives you an overview of all available commands:
kubeopsctl --help
Alternatively, you can also enter kubeopsctl or kubeopsctl -? in the command line.
Command ‘kubeopsctl pull’
The command kubeopsctl pull downloads all necessary KOSI packages to the admin node:
kubeopsctl pull
If you do not specify a parameter, the current Kubernetes version 1.32.2 will be pulled.
With parameter --kubernetesVersion 1.30.8 you can pull an older Kubernetes version.
kubeopsctl pull --kubernetesVersion 1.30.8
Available Kubernetes versions are 1.30.8, 1.31.6 and 1.32.2.
In order to download the KOSI packages, the ADMIN node must have an internet connection to the KubeOps hub
https://dispatcher.preprod.kubeops.net/v4/dispatcher/
Command ‘kubeopsctl apply’
The command kubeopsctl apply is used to set up the kubeops platform with a configuration file.
Example:
kubeopsctl apply -f kubeopsctl.yaml
-f flag
The -f parameter is used to use yaml parameter file.
-l flag
The -l parameter is used to set the log level to a specific value. The default log level is Info. Available log levels are Error, Warning, Info, Debug1, Debug2, Debug3.
Example:
kubeopsctl apply -f kubeopsctl.yaml -l Debug3
Command ‘kubeopsctl change registry’
The command kubeopsctl change registry is used to change the currently used registry to a different one.
Example:
kubeopsctl change registry -f kubeopsctl.yaml -r 10.2.10.11/library -t localhost/library
-f flag
The -f parameter is used to use yaml parameter file.
-r flag
The parameter r is used to pull the docker images which are included in the package to a given local docker registry.
-t flag
The -t parameter is used to tag the images with localhost. For the szenario that the registry of the cluster is exposed to the admin via a network internal domain name, but this name can’t be resolved by the nodes, the flag -t can be used, to use the cluster internal hostname of the registry.
Command ‘kubeopsctl drain’
The command kubeopsctl drain is used to drain a cluster, zone or node.
In this example we are draining a cluster:
kubeopsctl drain cluster/example
In this example we are draining a zone:
kubeopsctl drain zone/zone1
In this example we are draining a node:
kubeopsctl drain node/master1
there can be issues with the draining of nodes if there is rook installed, because rook has pod disruption budgets, so there must be enough nodes ready for rook.
Command ‘kubeopsctl uncordon’
The command kubeopsctl uncordon is used to drain a cluster, zone or node.
In this example we are uncordoning a cluster:
kubeopsctl uncordon cluster/example
In this example we are uncordoning a zone:
kubeopsctl uncordon zone/zone1
In this example we are uncordoning a node:
kubeopsctl uncordon node/master1
Command ‘kubeopsctl upgrade’
The command kubeopsctl upgrade is used to upgrade the kubernetes version of a cluster, zone or node.
In this example we are uncordoning a cluster:
kubeopsctl upgrade cluster/example -v 1.26.6
In this example we are uncordoning a zone:
kubeopsctl upgrade zone/zone1 -v 1.26.6
In this example we are uncordoning a node:
kubeopsctl upgrade node/master1 -v 1.26.6
-v flag
The parameter v is used to set a higher kubernetes version.
Command ‘kubeopsctl status’
The command kubeopsctl status is used to get the status of a cluster.
Example:
kubeopsctl status cluster/cluster1 -v 1.26.6