You can use the antreansxctl command to manage your Antrea environment.
The syntax of the
antreansxctl command:
antreansxctl --help antrea-nsx command line utility - version - Usage: antreansxctl [flags] antreansxctl [command] Available Commands: bootstrap Create cert and PI, generate the bootstrap config cluster-cleanup Cleanup ClusterControlPlane and ContainerCluster in case K8s cluster is destroyed without running deregister job. This operation is irreversible. cluster-get Get ClusterControlPlane and ContainerCluster cluster-list List all ClusterControlPlanes and ContainerClusters completion Generate the autocompletion script for the specified shell help Help about any command Flags: -h, --help help for antreansxctl Use "antreansxctl [command] --help" for more information about a command.
Cluster cleanup
You can use the antreansxctl cluster-cleanup command to clean up Antrea data. You can run this command when the cluster has been destroyed before the deregisterjob.yaml has run.
To clean up a cluster's registration and inventory, run one of the following commands:
antreansxctl cluster-cleanup --cluster-name string --nsx-ip string --user string --password string antreansxctl cluster-cleanup --cluster-id string --nsx-ip string --user string --password string
To clean up the registration and inventory for all clusters, run the following commands. This will deregister all Antrea clusters.
antreansxctl cluster-cleanup --delete-all --nsx-ip string --user string --password string
List all registered clusters
To list all registered clusters, including running clusters and left-over clusters, run the following command:
antreansxctl cluster-list --nsx-ip string --user string --password string
For example,
./bootstrap cluster-list --nsx-ip string --user admin --password string ----- Cluster Control Plane Resources ----- CLUSTER-NAME CLUSTER-ID wenqi-0004 6c018574-cd1f-4da0-b0f5-5965b270cd22 ----- Antrea Container Cluster Inventory Resources ---- CLUSTER-NAME CLUSTER-ID wenqi-0004 6c018574-cd1f-4da0-b0f5-5965b270cd22
View cluster registration and inventory information
Run one of the following commands:
antreansxctl cluster-get --cluster-name string --nsx-ip string --user string --password string antreansxctl cluster-get --cluster-id string --nsx-ip string --user string --password string
For example,
./bootstrap cluster-get --nsx-ip string --user string --password string --cluster-name=string ----- Cluster Control Plane Resources ----- CLUSTER-NAME CLUSTER-ID wenqi-0004 6c018574-cd1f-4da0-b0f5-5965b270cd22 ----- Antrea Container Cluster Inventory Resources ---- CLUSTER-NAME CLUSTER-ID wenqi-0004 6c018574-cd1f-4da0-b0f5-5965b270cd22
Bootstrap
Use this command to simplify the process of setting up a Kubernetes cluster and registering it to NSX Manager. It will automatically create a certificate and PI in NSX and generate the bootstrap configuration. The syntax is:
Usage: antreansxctl bootstrap [flags] Flags: --bootstrap-config-yaml-file string Optional. A bootstrap config yaml file path used as template input. The file can be found from Antrea-interworking deliverables. If this parameter is not provided, the command will use an embedded bootstrap config template, and the embedded bootstrap config comes from the same Antrea-interworking version as this command --cert string NSX manager admin cert --cluster-name string Name of the cluster to be registered to NSX -h, --help help for bootstrap --key string NSX manager admin key --nsx-managers string NSX manager IP or domain name, if there are multiple values, separate them with commas --password string NSX manager admin password --proxy-endpoints-rest-api string Optional.The proxy-endpoints-rest-api should be a string slice that contains the IP address or domain name of the REST API endpoint, if there are multiple values, separate them with commas --proxy-endpoints-rpc-fwd string Optional.The proxy-endpoints-rpc-fwd should be a string slice that contains the IP address or domain name of the NSX RPC forward proxy, if there are multiple values, separate them with commas --user string NSX manager admin username --vpcPath string Optional.It`s the NSX VPC path assigned to this cluster. Example: /orgs/default/projects/project1/vpcs/my-vpc1 . If VPC path is not specified, Enterprise admin role is assigned to the PI. If VPC path is specified, multi tenant Role bound to the VPC is assigned to the PI.
The following command will create a PI in NSX and generate a certificate, and generate the
bootstrap-config.yaml.
antreansxctl bootstrap --user string --password string --nsx-managers string --cluster-name string --vpcPath string --bootstrap-config-yaml-file string
The
antreansxctl bootstrap options:
- --cert string: NSX manager admin cert, either admin cert+key or admin username+password is required for authenticating with NSX.
- --cluster-name string: Required. Name of the cluster to be registered to NSX.
- --key string: NSX manager admin key, either admin cert+key or admin username+password is required for authenticating with NSX.
- --nsx-managers string: Required. NSX manager IP or domain name, if there are multiple values, separate them with commas.
- --proxy-endpoints-rest-api string: Optional.The proxy-endpoints-rest-api should be a string slice that contains the IP address or domain name of the REST API endpoint, if there are multiple values, separate them with commas.
- --proxy-endpoints-rpc-fwd string: Optional.The proxy-endpoints-rpc-fwd should be a string slice that contains the IP address or domain name of the NSX RPC forward proxy, if there are multiple values, separate them with commas.
- --password string: NSX manager admin password, either admin cert+key or admin username+password is required for authenticating with NSX.
- --user string: NSX manager admin username, either admin cert+key or admin username+password is required for authenticating with NSX.
- --vpcPath string: Optional.It's the NSX VPC path assigned to this cluster. Example: /orgs/default/projects/project1/vpcs/my-vpc1 . If VPC path is not specified, Enterprise admin role is assigned to the PI. If VPC path is specified, multi tenant Role bound to the VPC is assigned to the PI.
- --bootstrap-config-yaml-file string: Optional. A bootstrap config yaml file path used as template input. The file can be found from Antrea-interworking deliverables. If this parameter is not provided, the command will use an embedded bootstrap config template, and the embedded bootstrap config comes from the same Antrea-interworking version as this command.