GETTING STARTED

This section contains the most basic commands for deploy a kubeclipper on your machine.


deploy

Deploy All-In-One use local host, etcd port will be set automatically. (client-12379 | peer-12380 | metrics-12381)

kcctl deploy

Deploy AIO env and change etcd port

kcctl deploy --server 192.168.234.3 --agent 192.168.234.3 --passwd 'YOUR-SSH-PASSWORD' --etcd-port 12379 --etcd-peer-port 12380 --etcd-metric-port 12381

Deploy HA env

kcctl deploy --server 192.168.234.3,192.168.234.4,192.168.234.5 --agent 192.168.234.3 --passwd 'YOUR-SSH-PASSWORD' --etcd-port 12379 --etcd-peer-port 12380 --etcd-metric-port 12381

Deploy env use SSH key instead of password

kcctl deploy --server 192.168.234.3 --agent 192.168.234.3 --pk-file ~/.ssh/id_rsa --pkg kc-minimal.tar.gz

Deploy env use remove http/https resource server

kcctl deploy --server 192.168.234.3 --agent 192.168.234.3 --pk-file ~/.ssh/id_rsa --pkg https://oss.kubeclipper.io/release/v1.4.0/kc-amd64.tar.gz

Deploy env with many agent node in same region.

kcctl deploy --server 192.168.234.3 --agent us-west-1:192.168.10.123,192.168.10.124  --pk-file ~/.ssh/id_rsa --pkg https://oss.kubeclipper.io/release/v1.4.0/kc-amd64.tar.gz

Deploy env with many agent node in different region.

kcctl deploy --server 192.168.234.3 --agent us-west-1:1.1.1.1,1.1.1.2 --agent us-west-2:1.1.1.3 --pk-file ~/.ssh/id_rsa --pkg https://oss.kubeclipper.io/release/v1.4.0/kc-amd64.tar.gz

Deploy env with many agent node which has orderly ip. # this will add 10 agent,1.1.1.1, 1.1.1.2, ... 1.1.1.10.

kcctl deploy --server 192.168.234.3 --agent us-west-1:1.1.1.1-1.1.1.10 --pk-file ~/.ssh/id_rsa --pkg https://oss.kubeclipper.io/release/v1.4.0/kc-amd64.tar.gz

Deploy env with many agent nodes and specify ip detect method for these nodes

kcctl deploy --server 192.168.234.3 --agent 192.168.234.3,192.168.234.4 --ip-detect=interface=eth0 --pk-file ~/.ssh/id_rsa --pkg https://oss.kubeclipper.io/release/v1.4.0/kc-amd64.tar.gz

Deploy env with many agent nodes and specify node ip detect method for these nodes, used for routing between nodes in the kubernetes cluster

kcctl deploy --server 192.168.234.3 --agent 192.168.234.3,192.168.234.4 --node-ip-detect=interface=eth1 --pk-file ~/.ssh/id_rsa --pkg https://oss.kubeclipper.io/release/v1.4.0/kc-amd64.tar.gz

Deploy from config.

kcctl deploy --deploy-config deploy-config.yaml

Deploy and config fip to agent node.

kcctl deploy --server 172.20.149.198 --agent us-west-1:10.0.0.10 --agent us-west-2:20.0.0.11 --fip 10.0.0.10:172.20.149.199 --fip 20.0.0.11:172.20.149.200
Please read 'kcctl deploy -h' get more deploy flags


Deploy Kubeclipper Platform from deploy-config.yaml or cmd flags.

Kubeclipper Platform must have one kc-server node at lease, kc-server use etcd as db backend.
So the number of kc-server nodes must be odd

If you want to deploy kc-server and kc-agent on the same node, it is better to change etcd port configuration,
in order to be able to deploy k8s on this node

Now only support offline install, so the --pkg parameter must be valid

Usage

$ kcctl deploy (-c CONFIG | [flags])

Flags

Name Shorthand Default Usage
agent [] Kc agent region and ips.
audit-number n 200 Number of log retention
audit-period p 168h0m0s log retention time, minimal value is 10 minutes
authenticate-rate-limiter-duration 10m0s specifies the lock duration of the user
authenticate-rate-limiter-max-retries 5 maximum number of retry times within the valid period
console-port 80 kc console port
debug false Deploy kc use debug mode
deploy-config c Path to the config file to use for Deploy.
etcd-data-dir /var/lib/kc-etcd Etcd data dir(absolute path)
etcd-metric-port 12381 Etcd metric port
etcd-peer-port 12380 Etcd peer port
etcd-port 12379 Etcd port
float-ip [] Kc agent ip and float ip.
initial-password Thinkbig1 admin user password
ip-detect first-found Kc agent node ip detect method. Used to route between nodes.

To eliminate node specific IP address configuration,the KubeClipper can be configuredto autodetect these IP addresses.
In many systems, there might be multiple physical interfaces on a host, or possibly multiple IP addresses configured
on a physical interface.In these cases, there are multiple addresses to choose from and soautodetection of the correct
address can be tricky.

The IP autodetection methods are provided to improve the selection of thecorrect address, by limiting the selection
based on suitable criteria for your deployment.

The following sections describe the available IP autodetection methods.

1. first-found
The first-found option enumerates all interface IP addresses and returns the first valid IP address (based on IP version
and type of address) on the first valid interface.
Certain known “local” interfaces are omitted, such as the docker bridge.The order that both the interfaces and the IP
addresses are listed is system dependent.

This is the default detection method.
However, since this method only makes a very simplified guess,it is recommended to either configure the node with a
specific IP address,or to use one of the other detection methods.

2. interface=INTERFACE-REGEX
The interface method uses the supplied interface regular expression to enumerate matching interfaces and to return the
first IP address on the first matching interface.
The order that both the interfaces and the IP addresses are listed is system dependent.

Example with valid IP address on interface eth0, eth1, eth2 etc.:
interface=eth.*

3. cidr=CIDR
The cidr method will select any IP address from the node that falls within the given CIDRs.
Example:
cidr=10.0.1.0/24,10.0.2.0/24
kc-image-repo-mirror K8s image repository mirror
kc-server-health-check-timeout 30s kc server health check timeout, default is 30s
login-history-maximum-entries 100 login-history-maximum-entries defines how many entries of login history should be kept.
login-history-retention-period 168h0m0s login-history-retention-period defines how long login history should be kept.
mq-ca Kc external mq client ca file path(absolute path)
mq-cert Kc external mq client cert file path(absolute path)
mq-cluster-port 9890 Kc mq cluster port
mq-external false Kc external mq
mq-ips [] external mq ips.
mq-key Kc external mq client key file path(absolute path)
mq-port 9889 Kc built-in mq or external mq port
mq-secret external mq user secret
mq-tls true Kc external mq client and built-in mq client/server use tls mode. built-in mq client/server cert automatic generation
mq-user admin external mq user
node-ip-detect Kc agent node ip detect method. Used for routing between nodes in the kubernetes cluster. If not specified, ip-detect is inherited.

To eliminate node specific IP address configuration,the KubeClipper can be configuredto autodetect these IP addresses.
In many systems, there might be multiple physical interfaces on a host, or possibly multiple IP addresses configured
on a physical interface.In these cases, there are multiple addresses to choose from and soautodetection of the correct
address can be tricky.

The IP autodetection methods are provided to improve the selection of thecorrect address, by limiting the selection
based on suitable criteria for your deployment.

The following sections describe the available IP autodetection methods.

1. first-found
The first-found option enumerates all interface IP addresses and returns the first valid IP address (based on IP version
and type of address) on the first valid interface.
Certain known “local” interfaces are omitted, such as the docker bridge.The order that both the interfaces and the IP
addresses are listed is system dependent.

This is the default detection method.
However, since this method only makes a very simplified guess,it is recommended to either configure the node with a
specific IP address,or to use one of the other detection methods.

2. interface=INTERFACE-REGEX
The interface method uses the supplied interface regular expression to enumerate matching interfaces and to return the
first IP address on the first matching interface.
The order that both the interfaces and the IP addresses are listed is system dependent.

Example with valid IP address on interface eth0, eth1, eth2 etc.:
interface=eth.*

3. cidr=CIDR
The cidr method will select any IP address from the node that falls within the given CIDRs.
Example:
cidr=10.0.1.0/24,10.0.2.0/24
oplog-dir /var/log/kc-agent kc agent operation log dir
oplog-threshold 1048576 kc agent operation log single threshold
passwd Deploy ssh password
pk-file ssh pk file which used to remote access other agent nodes
pk-passwd the password of the ssh pk file which used to remote access other agent nodes
pkg Package resource url (path or http url)
region r default Kc agent default region
server [] Kc server ips
server-port 8080 Kc server port
ssh-port 22 ssh connection port of agent nodes
static-server-path /opt/kubeclipper-server/resource Kc static server path(absolute path
static-server-port 8081 Kc static server port
tls true Kc api server use tls mode
user u root Deploy ssh user

config

default config to deploy-config.yaml

kcctl deploy config > deploy-config.yaml

Print default deploy config.

Usage

$ kcctl deploy config


clean

Uninstall the entire kubeclipper platform.

kcctl clean --all
kcctl clean -A

Mock uninstall,without -A flag will only do preCheck and config check.

kcctl clean

Uninstall the entire kubeclipper platform,use specify the auth config.

kcctl clean -A --config ~/.kc/config

Uninstall the entire kubeclipper platform,use local deploy config when kc-server is not health.

kcctl clean -A -f
Please read 'kcctl clean -h' get more clean flags


Uninstall kubeclipper Platform .

Uninstall all kubeclipper plug-ins.

Usage

$ kcctl clean [flags]

Flags

Name Shorthand Default Usage
all A false clean all components for kubeclipper
config /home/runner/.kc/config Path to the config file to use for CLI requests.
deploy-config /home/runner/.kc/deploy-config.yaml path to the deploy config file to use for clean,just work with force flag.
force f false force use local deploy config to clean kubeclipper when kc-server not health

create

Create cluster offline. The default value of offline is true, so it can be omitted.

kcctl create cluster --name demo --master 192.168.10.123

Create role has permission to view cluster

kcctl create role --name cluster_viewer --rules=role-template-view-clusters

Create user with required parameters

kcctl create user --name simple-user --role=platform-view --password 123456 --phone 10086 --email simple@example.com

Create cluster use cluster.yaml.

kcctl create -f cluster.yaml
cluster.yaml example:
kind: Cluster
apiVersion: core.kubeclipper.io/v1
metadata:
annotations:
kubeclipper.io/offline: "true"

"true"

name: test
kubernetesVersion: v1.27.4
localRegistry: ""
masters:
- id: 088885e3-4098-413d-a7e7-39adf0ffa95f

labels: # test: "1234" # taints: # - key: node-role.kubernetes.io/control-plane # value: "" # effect: NoSchedule

workers: []
certSans: []

# xxx: true

cni:
calico:
IPManger: true
IPv4AutoDetection: first-found
IPv6AutoDetection: first-found
mode: Overlay-Vxlan-All
mtu: 1440
criType: containerd
localRegistry: ""
namespace: calico-system
offline: true
type: calico
version: v3.26.1
containerRuntime:
type: containerd
version: 1.6.4
etcd:
dataDir: /var/lib/etcd
kubeProxy: {}
kubelet:
ipAsName: false
rootDir: /var/lib/kubelet
networking:
dnsDomain: cluster.local
ipFamily: IPv4
pods:
cidrBlocks:
- "172.25.0.0/16"
proxyMode: ipvs
services:
cidrBlocks:
- "10.96.0.0/12"
workerNodeVip: 169.254.169.100


Create specified resource

Using the create command to create cluster, user, or role resources.
Or you can choose to create those directly from a file.

Usage

$ kcctl create (--filename | -f <FILE-NAME>)

Flags

Name Shorthand Default Usage
config /home/runner/.kc/config Path to the config file to use for CLI requests.
filename f use resource file to create
output o table Output format either: json,yaml,table

cluster

Create cluster offline. The default value of offline is true, so it can be omitted.

kcctl create cluster --name demo --master 192.168.10.123

Create cluster online

kcctl create cluster --name demo --master 192.168.10.123 --offline false --local-registry 192.168.10.123:5000

Create cluster with taint manage

kcctl create cluster --name demo --master 192.168.10.123 --untaint-master

Create cluster with worker.

kcctl create cluster --name demo --master 192.168.10.123 --worker 192.168.10.124
Please read 'kcctl create cluster -h' get more create cluster flags.

Create cluster using command line

Usage

$ kcctl create cluster (--name) <name> (-m|--master) <id or ip> [(--offline <false> | <true>)] [(--cri <docker> | <containerd>)] [(--cni <calico> | <others> )] [flags]

Flags

Name Shorthand Default Usage
ca-cert k8s external root-ca cert file
ca-key k8s external root-ca key file
calico.ipv4-auto-detection first-found node ipv4 auto detection.

When Calico is used for routing, each node must be configured with an IPv4 address and/or an IPv6 address that
will beused to route between nodes. To eliminate node specific IP address configuration, the calico/node container
can be configuredto autodetect these IP addresses. In many systems, there might be multiple physical interfaces on
a host, or possibly multipleIP addresses configured on a physical interface. In these cases, there are multiple
addresses to choose from and so autodetectionof the correct address can be tricky.

The IP autodetection methods are provided to improve the selection of the correct address, by limiting the
selection basedon suitable criteria for your deployment.

The following sections describe the available IP autodetection methods.

1. first-found
The first-found option enumerates all interface IP addresses and returns the first valid IP address
(based on IP versionand type of address) on the first valid interface.
Certain known “local” interfaces are omitted, such as the docker bridge.The order that both the interfaces
and the IPaddresses are listed is system dependent.

This is the default detection method.
However, since this method only makes a very simplified guess,it is recommended to either configure the node with
a specific IP address,or to use one of the other detection methods.

2. interface=INTERFACE-REGEX
The interface method uses the supplied interface regular expression to enumerate matching interfaces and to
return thefirst IP address on the first matching interface.
The order that both the interfaces and the IP addresses are listed is system dependent.

Example with valid IP address on interface eth0, eth1, eth2 etc.:
interface=eth.*

3. can-reach=DESTINATION
The can-reach method uses your local routing to determine which IP address will be used to reach the supplied
destination.Both IP addresses and domain names may be used.

Example using IP addresses:
IP_AUTODETECTION_METHOD=can-reach=8.8.8.8
IP6_AUTODETECTION_METHOD=can-reach=2001:4860:4860::8888

Example using domain names:
IP_AUTODETECTION_METHOD=can-reach=www.google.com
IP6_AUTODETECTION_METHOD=can-reach=www.google.com
calico.net-mode Overlay-Vxlan-All calico network mode, support [BGP|Overlay-IPIP-All|Overlay-IPIP-Cross-Subnet|Overlay-Vxlan-All|Overlay-Vxlan-Cross-Subnet] now.

The following sections describe the available calico network modes.

1. BGP
Using the pod network in BGP mode, the pod network can be easily connected to the physical network with the best
performance. It is suitable for bare metal environments and network environments that support the BGP protocol.

2. Overlay-IPIP-All
A pod network in overlay mode using IP-in-IP technology, suitable for environments where all underlying platforms support IPIP.

3. Overlay-IPIP-Cross-Subnet
Use the overlay mode pod network of IP-in-IP technology when communicating on different network segments, host routing
when communicating on the same network segment, suitable for bare metal environments with complex network environments.

4. Overlay-Vxlan-All
The overlay mode pod network using vxlan technology is suitable for almost all platforms but the performance is reduced.

5. Overlay-Vxlan-Cross-Subnet
Use the overlay mode pod network of vxlan technology when communicating on different network segments, and host routing
when communicating on the same network segment, suitable for bare metal environments with complex network environments.
cert-sans [] k8s cluster certificate signing ipList or domainList
cluster-dns-domain cluster.local k8s cluster domain
cni calico k8s cni type, calico or others
cni-version k8s cni version
config /home/runner/.kc/config Path to the config file to use for CLI requests.
cri containerd k8s cri type, docker or containerd
cri-version k8s cri version
feature-gates [] k8s feature gates, format as: --feature-gates=xxx=true|false
insecure-registry [] use remote registry address to pull image
k8s-version k8s version
kubeadm-init-ignore-preflight-errors A list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.,kubeadm init --ignore-preflight-errors=xxx
local-registry use local registry address to pull image
master m [] k8s master node id or ip
name k8s cluster name
offline true create cluster online(false) or offline(true)
only-install-kubernetes-component false only install kubernetes component, not install cni
output o table Output format either: json,yaml,table
pod-subnet 172.25.0.0/16 podSubnet is the subnet used by Pods. Defaults to '172.25.0.0/16'
service-subnet 10.96.0.0/12 serviceSubnet is the subnet used by Kubernetes Services. Defaults to '10.96.0.0/12'
untaint-master false untaint master node after cluster create
worker [] k8s worker node id or ip

role

Create role has permission to view cluster

kcctl create role --name cluster_viewer --rules=role-template-view-clusters

Create role has permission to view cluster and user

kcctl create role --name viewer --rules=role-template-view-clusters  --rules=role-template-view-users
You can use cmd kcctl get role --selector=kubeclipper.io/role-template=true to query rules.
Please read 'kcctl create role -h' get more create role flags.

Create role using command line

Usage

$ kcctl create role (--rules <rules>)

Flags

Name Shorthand Default Usage
config /home/runner/.kc/config Path to the config file to use for CLI requests.
name role name
output o table Output format either: json,yaml,table
rules [] role template rules (separated by comma)

user

Create user with required parameters

kcctl create user --name simple-user --role=platform-view --password 123456 --phone 10086 --email simple@example.com

Create user with all parameters

kcctl create user --name full-user --role=platform-view --password 123456 --phone 10010 --email full@example.com --description 'a full info user' --display-name 'full'
Please read 'kcctl create user -h' get more create user flags.

Create user using command line

Usage

$ kcctl create user (--name) (--role) (--password) (--phone) (--email) [flag]

Flags

Name Shorthand Default Usage
config /home/runner/.kc/config Path to the config file to use for CLI requests.
description user description
display-name user display name
email user email address
name user name
output o table Output format either: json,yaml,table
password user password
phone user phone number
role user role

get

List all users in ps output format.

kcctl get user

List user in json output format

kcctl get user -o json

List user with label-selector

kcctl get user --selector foo=bar

List user with field-selector

kcctl get user --field-selector .metadata.name=foo

Describe user admin

kcctl get user admin -o yaml

List other resource

kcctl get [role,cluster,node]
Please read 'kcctl get -h' get more get flags


Display one or many resources

Prints a table of the most important information about the specified resources.
You can filter the list using a label selector and the --selector flag.

Notice: You must run 'kcctl login' at first, you can get help to run 'kcctl login -h'

Usage

$ kcctl get [(-o|--output=)table|json|yaml] (TYPE [NAME | -l label] | TYPE/NAME ...) [flags]

Flags

Name Shorthand Default Usage
config /home/runner/.kc/config Path to the config file to use for CLI requests.
field-selector Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.
output o table Output format either: json,yaml,table
selector l Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
watch w false After listing/getting the requested object, watch for changes.

delete

Delete kubeclipper cluster

kcctl delete cluster 'CLUSTER-NAME'

Delete kubeclipper user

kcctl delete user 'USER-NAME'

Delete kubeclipper role

kcctl delete role 'ROLE-NAME'
Please read 'kcctl delete -h' get more delete flags.


Delete kubeclipper resources.

Currently,only clusters, users and roles resources can be supported.

Usage

$ kcctl delete (<cluster> | <user> | <role>) [flags]

Flags

Name Shorthand Default Usage
config /home/runner/.kc/config Path to the config file to use for CLI requests.
force F false Force delete resource. Now is only support cluster.

NODE MANAGEMENT

This section contains commands for join, drain your kubeclipper node,and management offline resource package.


join

Add agent node.

kcctl join --agent 192.168.10.123

Add agent node specify region.

kcctl join --agent us-west-1:192.168.10.123

Add multiple agent nodes.

kcctl join --agent 192.168.10.123,192.168.10.124

Add multiple agent nodes in same region.

kcctl join --agent us-west-1:192.168.10.123,192.168.10.124

Add multiple agent nodes node in different region

kcctl join --agent us-west-1:1.2.3.4 --agent us-west-2:2.3.4.5

add multiple agent nodes which has orderly ip. # this will add 10 agent,1.1.1.1, 1.1.1.2, ... 1.1.1.10.

kcctl join --agent us-west-1:1.1.1.1-1.1.1.10

Add multiple agent nodes and config float ip.

kcctl join --agent 192.168.10.123,192.168.10.124 --float-ip 192.168.10.123:172.20.149.199 --float-ip 192.168.10.124:172.20.149.200

Add agent nodes use config file. join config example:

ssh:
user: root
password: "0000"
pkFile: ""
privateKey: ""
pkPassword: ""
port: 22
connectionTimeout: 1m0s

MethodFirst = "first-found" # MethodInterface = "interface=" # MethodCidr = "cidr=" # MethodCanReach = "can-reach="

ipDetect: first-found
nodeIPDetect: first-found
agents:
192.168.234.41:

default #floatIP: #proxyServer: #proxyAPIServer: #proxySSH:

192.168.234.42:

default2 #floatIP: #proxyServer: #proxyAPIServer: #proxySSH:

kcctl join --join-config join-config.yaml
Please read 'kcctl join -h' get more deploy flags


Add Server and Agents nodes on kubeclipper platform.

At least one Server node must be installed before adding an Agents node.

Usage

$ kcctl join [flags]

Flags

Name Shorthand Default Usage
agent [] join agent node.
config /home/runner/.kc/config Path to the config file to use for CLI requests.
float-ip [] Kc agent ip and float ip.
ip-detect first-found Kc agent node ip detect method. Used to route between nodes.

To eliminate node specific IP address configuration,the KubeClipper can be configuredto autodetect these IP addresses.
In many systems, there might be multiple physical interfaces on a host, or possibly multiple IP addresses configured
on a physical interface.In these cases, there are multiple addresses to choose from and soautodetection of the correct
address can be tricky.

The IP autodetection methods are provided to improve the selection of thecorrect address, by limiting the selection
based on suitable criteria for your deployment.

The following sections describe the available IP autodetection methods.

1. first-found
The first-found option enumerates all interface IP addresses and returns the first valid IP address (based on IP version
and type of address) on the first valid interface.
Certain known “local” interfaces are omitted, such as the docker bridge.The order that both the interfaces and the IP
addresses are listed is system dependent.

This is the default detection method.
However, since this method only makes a very simplified guess,it is recommended to either configure the node with a
specific IP address,or to use one of the other detection methods.

2. interface=INTERFACE-REGEX
The interface method uses the supplied interface regular expression to enumerate matching interfaces and to return the
first IP address on the first matching interface.
The order that both the interfaces and the IP addresses are listed is system dependent.

Example with valid IP address on interface eth0, eth1, eth2 etc.:
interface=eth.*

3. cidr=CIDR
The cidr method will select any IP address from the node that falls within the given CIDRs.
Example:
cidr=10.0.1.0/24,10.0.2.0/24
join-config path to the join config file to use for join
node-ip-detect Kc agent node ip detect method. Used for routing between nodes in the kubernetes cluster. If not specified, ip-detect is inherited.

To eliminate node specific IP address configuration,the KubeClipper can be configuredto autodetect these IP addresses.
In many systems, there might be multiple physical interfaces on a host, or possibly multiple IP addresses configured
on a physical interface.In these cases, there are multiple addresses to choose from and soautodetection of the correct
address can be tricky.

The IP autodetection methods are provided to improve the selection of thecorrect address, by limiting the selection
based on suitable criteria for your deployment.

The following sections describe the available IP autodetection methods.

1. first-found
The first-found option enumerates all interface IP addresses and returns the first valid IP address (based on IP version
and type of address) on the first valid interface.
Certain known “local” interfaces are omitted, such as the docker bridge.The order that both the interfaces and the IP
addresses are listed is system dependent.

This is the default detection method.
However, since this method only makes a very simplified guess,it is recommended to either configure the node with a
specific IP address,or to use one of the other detection methods.

2. interface=INTERFACE-REGEX
The interface method uses the supplied interface regular expression to enumerate matching interfaces and to return the
first IP address on the first matching interface.
The order that both the interfaces and the IP addresses are listed is system dependent.

Example with valid IP address on interface eth0, eth1, eth2 etc.:
interface=eth.*

3. cidr=CIDR
The cidr method will select any IP address from the node that falls within the given CIDRs.
Example:
cidr=10.0.1.0/24,10.0.2.0/24
passwd Deploy ssh password
pk-file ssh pk file which used to remote access other agent nodes
pk-passwd the password of the ssh pk file which used to remote access other agent nodes
pkg Package resource url (path or http url). Default is inherited from the deploy config.
ssh-port 22 ssh connection port of agent nodes
user u root Deploy ssh user

drain

Drain kc-agent from kubeclipper cluster use default config(~/.kc/config).

kcctl drain --agent d55e10ec-4e7e-4ce9-9ce7-eb491ddc7bfa

Drain kc-agent from kubeclipper cluster specify config.

kcctl drain --agent d55e10ec-4e7e-4ce9-9ce7-eb491ddc7bfa --config /root/.kc/config

Force drain kc-agent which is in used from kubeclipper cluster

kcctl drain  --force --agent=d55e10ec-4e7e-4ce9-9ce7-eb491ddc7bfa
Please read 'kcctl drain -h' get more drain flags.


Drain the Kubeclipper server or agent node from the cluster.

Now only support drain kc-agent node, so the --agent parameter must be valid.

Usage

$ kcctl drain (--agent <agentIDs>) [flags]

Flags

Name Shorthand Default Usage
agent [] drain agent node ID.
config /home/runner/.kc/config Path to the config file to use for CLI requests.
force F false force delete in used node.

resource

List offline resource packs

kcctl resource list

Push offline resource packs

kcctl resource push --pkg /root/docker-19.03.12-amd64.tar.gz --type cri

Delete offline resource packs

kcctl resource delete --name k8s --version v1.23.6 --arch amd64
Please read 'kcctl resource -h' get more resource flags.


Online resource operation.

Currently, You can push, delete, and list offline resource packs.

Usage

$ kcctl resource


delete

Delete offline resource packs

kcctl resource delete --name k8s --version v1.23.6 --arch amd64
Please read 'kcctl resource delete -h' get more resource delete flags

Delete offline resource packs

You can delete existing offline packages. You need to specify the name, type, arch of offline packages before deleting.

Usage

$ kcctl resource delete (--name <pkg-name>) (--version <pkg-version>) (--arch <pkg-arch>) [flags]

Flags

Name Shorthand Default Usage
arch amd64 offline resource arch.
config /home/runner/.kc/config Path to the config file to use for CLI requests.
name offline resource name.
version offline resource version.

list

List offline resource

kcctl resource list

List offline resource use specified output format

kcctl resource list  --output 'YAML|TABLE|JSON'
Please read 'kcctl resource list -h' get more resource list flags

List offline resource packs

You can list, push, or delete offline resource packs.

Usage

$ kcctl resource list [flags]

Flags

Name Shorthand Default Usage
arch amd64 offline resource arch.
config /home/runner/.kc/config Path to the config file to use for CLI requests.
name offline resource name.
output o table Output format either: json,yaml,table
type offline resource type.
version offline resource version.

push

Push k8s offline resource k8s

kcctl resource push --pkg /root/k8s-v1.23.6-amd64.tar.gz --type k8s

Push docker offline resource csi

kcctl resource push --pkg /root/docker-19.03.12-amd64.tar.gz --type cri

Push offline resource nfs

kcctl resource push --pkg /root/nfs-v4.0.2-amd64.tar.gz --type csi
Please read 'kcctl resource push -h' get more resource push flags

Push offline resource packs

You can push a .tar.gz file of the specified type

Naming rules for offline packages: name-version-arch.tar.gz Structure of the offline package: name/version/ name/version/arch/ name/version/arch/images.tar.gz name/version/arch/manifest.json

Usage

$ kcctl resource push (--pkg <file name>) (--type <resource type>) [flags]

Flags

Name Shorthand Default Usage
config /home/runner/.kc/config Path to the config file to use for CLI requests.
pkg docker service and images pkg.
type offline resource type.

REGISTRY

This section contains commands for deploying docker registry and usage.


registry

Deploy docker registry

kcctl registry deploy --pk-file key --node 10.0.0.111 --pkg kc.tar.gz

Deploy docker registry without image load

kcctl registry deploy --pk-file key --node 10.0.0.111 --pkg kc.tar.gz --skip-image-load

Clean docker registry

kcctl registry clean --pk-file key --node 10.0.0.111

Push docker image to registry

kcctl registry push --pk-file key --node 10.0.0.111 --pkg images.tar.gz

List repositories in docker registry

kcctl registry list --node 10.0.0.111  --type repository

Delete docker image

kcctl registry delete --node 10.0.0.111  --name etcd --tag 1.5.1-0
Please read 'kcctl registry -h' get more registry flags.


Docker registry operation.

Currently, you can deploy, clean, push, list and delete docker registry.
Use docker engine API V2, visit the website(https://docs.docker.com/registry/spec/api/) for more information.

Usage

$ kcctl registry


clean

Clean docker registry

kcctl registry clean --pk-file key --node 10.0.0.111

Clean docker registry, specify data directory. # If you used custom data directory when deploy,then must specify it in this cmd to clear data.

kcctl registry clean --pk-file key --node 10.0.0.111 --registry-volume /opt/registry --data-root /var/lib/docker

Clean docker registry

kcctl registry clean --pk-file key --node 10.0.0.111

Forced to clean docker registry

kcctl registry clean --pk-file key --node 10.0.0.111  --force
Please read 'kcctl registry clean -h' get more registry clean flags.

Clean docker registry by flags.

Usage

$ kcctl registry clean (--user | -u <user>) (--passwd <passwd>) (--pk-file <pk-file>) (--pk-passwd <pk-passwd>) (--node <node>)

Flags

Name Shorthand Default Usage
node registry node.
passwd Deploy ssh password
pk-file ssh pk file which used to remote access other agent nodes
pk-passwd the password of the ssh pk file which used to remote access other agent nodes
ssh-port 22 ssh connection port of agent nodes
user u root Deploy ssh user

delete

Delete docker image

kcctl registry delete --pk-file key --node 10.0.0.111  --name etcd --tag 3.5.1-0
Please read 'kcctl registry delete -h' get more registry delete flags.

Delete the docker image by name and tag.

Usage

$ kcctl registry delete (--pk-file <file path>) (--node <node>) (--name <name>) (--tag <tag>) [flags]delete (--pk-file <file path>) (--node <node>) (--name <name>) (--tag <tag>) [flags]

Flags

Name Shorthand Default Usage
name image name
node registry node.
passwd Deploy ssh password
pk-file ssh pk file which used to remote access other agent nodes
pk-passwd the password of the ssh pk file which used to remote access other agent nodes
registry-port 5000 registry port
ssh-port 22 ssh connection port of agent nodes
tag image tag
user u root Deploy ssh user

deploy

Deploy docker registry

kcctl registry deploy --pk-file key --node 10.0.0.111 --pkg kc.tar.gz

Deploy docker registry specify data directory

kcctl registry deploy --pk-file key --node 10.0.0.111 --pkg kc.tar.gz  --data-root /var/lib/myregistry

Deploy docker registry specify port # If you used custom port,then must specify it in push、list、delete cmd.

kcctl registry deploy --pk-file key --node 10.0.0.111 --pkg kc.tar.gz --registry-port 6666
Please read 'kcctl registry deploy -h' get more registry deploy flags.

Deploy docker registry.

Usage

$ kcctl registry deploy (--user | -u <user>) (--passwd <passwd>) (--pk-file <pk-file>) (--pk-passwd <pk-passwd>) (--node <node>) (--pkg <pkg>) (--data-root <data-root>) (--registry-port <registry-port>) [flags]

Flags

Name Shorthand Default Usage
data-root /var/lib/registry set registry data root directory.
node node to deploy registry.
passwd Deploy ssh password
pk-file ssh pk file which used to remote access other agent nodes
pk-passwd the password of the ssh pk file which used to remote access other agent nodes
pkg registry service and images pkg.
registry-port 5000 set registry port
skip-image-load false set to skip image load,if set true will skip image load when deploy registry
ssh-port 22 ssh connection port of agent nodes
user u root Deploy ssh user

list

Lists docker repositories

kcctl registry list --node 10.0.0.111  --type repository

Lists docker images

kcctl registry list --node 10.0.0.111  --type image --name etcd
Please read 'kcctl registry list -h' get more registry list flags.

Lists docker repositories or images by flags.

Usage

$ kcctl registry list (--node <node>) (--name <name>) (--registry-port <registry-port>) (--type <type>) (--number <number>) [flags]list (--node <node>) (--name <name>) (--registry-port <registry-port>) (--type <type>) (--number <number>) [flags]

Flags

Name Shorthand Default Usage
name image name
node registry node
number 0 number of entries in each response. It not present, all entries will be returned.
output o table Output format either: json,yaml,table
passwd Deploy ssh password
pk-file ssh pk file which used to remote access other agent nodes
pk-passwd the password of the ssh pk file which used to remote access other agent nodes
registry-port 5000 registry port
ssh-port 22 ssh connection port of agent nodes
type repository image or repository
user u root Deploy ssh user

push

Push docker image to registry # You can use [docker save $images > images.tar && gzip -f images.tar] to generate image pkg # example: docker save k8s.gcr.io/pause:3.2 k8s.gcr.io/coredns/coredns:1.6.7 > images.tar && gzip -f images.tar

kcctl registry push --pk-file key --node 10.0.0.111  --pkg images.tar.gz
Please read 'kcctl registry push -h' get more registry push flags.

Push docker image by flags.

Usage

$ kcctl registry push (--node <node>) (--pkg <pkg>) [--registry-port <registry-port>] [flags]

Flags

Name Shorthand Default Usage
node registry node.
pkg docker images pkg,use docker save $images &gt; images.tar && gzip -f images.tar to generate images.tar.gz
registry-port 5000 registry port.

KCCTL SETTINGS AND USAGE


completion

Installing bash completion on macOS using homebrew ## If running Bash 3.2 included with macOS

brew install bash-completion

or, if running Bash 4.1+

brew install bash-completion@2

If kcctl is installed via homebrew, this should start working immediately. ## If you've installed via other means, you may need add the completion to your completion directory

kcctl completion bash > $(brew --prefix)/etc/bash_completion.d/kcctl

Installing bash completion on Linux ## If bash-completion is not installed on Linux, please install the 'bash-completion' package ## via your distribution's package manager. ## Load the kcctl completion code for bash into the current shell

source <(kcctl completion bash)

Write bash completion code to a file and source if from .bash_profile

kcctl completion bash > ~/.kube/completion.bash.inc
printf "

kcctl shell completion

source '$HOME/.kube/completion.bash.inc'
" >> $HOME/.bash_profile
source $HOME/.bash_profile

Load the kcctl completion code for zsh[1] into the current shell

source <(kcctl completion zsh)

Set the kcctl completion code for zsh[1] to autoload on startup

kcctl completion zsh > "${fpath[1]}/_kcctl"


Output shell completion code for the specified shell (bash or zsh).
The shell code must be evaluated to provide interactive
completion of kcctl commands. This can be done by sourcing it from
the .bash_profile.

Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2

Usage

$ kcctl completion SHELL


login

Login to the kubeclipper server

kcctl login --host https://127.0.0.1 --username admin

Login to the kubeclipper server via passwd by cli

kcctl login --host https://127.0.0.1 --username admin --password xxx
Please read 'kcctl login -h' get more login flags.


Login to the kubeclipper server and acquire access token.

This command is the pre-operation of several cli commands, So if you encounter this error 'open /root/.kc/config: no such file or directory', you may need to execute the login command first.

The command currently stores the results to the /root/.kc/config file by default.

Usage

$ kcctl login (--host | -H <host>) (--username | -u <username>) [flags]

Flags

Name Shorthand Default Usage
host H kubeclipper server address, format as https://host
password p kubeclipper user password
username u kubeclipper username

version

Print version Information

kcctl version -o yaml
Please read 'kcctl version -h' get more version flags.


Print kcctl version information.

Usage

$ kcctl version [flags]

Flags

Name Shorthand Default Usage
config /home/runner/.kc/config Path to the config file to use for CLI requests.
output o Output format; available options are 'yaml', 'json' and 'short'