To run CLI commands, log in to the NSX-T Container Plug-in container, open a terminal and run the nsxcli command.

You can also get the CLI prompt by running the following command on a node:

  kubectl exec -it <pod name> nsxcli

Table 1. CLI Commands for the NCP Container

Type

Command

Status

get ncp-nsx status

Status

get ncp-k8s-api-server status

Status

get ncp-watcher <watcher-name>

Status

get ncp-watchers

Cache

get project-cache <project-name>

Cache

get project-caches

Cache

get namespace-cache <namespace-name>

Cache

get namespace-caches

Cache

get pod-cache <pod-name>

Cache

get pod-caches

Cache

get ingress-caches

Support

get support-bundle file <filename>

Support

get ncp-log file <filename>

Support

get node-agent-log file <filename>

Support

get node-agent-log file <filename> <node-name>

Table 2. CLI Commands for the NSX Node Agent Container

Type

Command

Status

get node-agent-hyperbus status

Cache

get app-cache <app-name>

Cache

get app-caches

Table 3. CLI Commands for the NSX Kube Proxy Container

Type

Command

Status

get ncp-k8s-api-server status

Status

get kube-proxy-watcher <watcher-name>

Status

get kube-proxy-watchers

Status

dump ovs-flows

Status Commands for the NCP Container

  • Show the connection status between NCP and NSX Manager

    get ncp-nsx status

    Example:

    kubenode> get ncp-nsx status
    NSX Manager status: Healthy
  • Show the connection status between NCP and Kubernetes API server

    get ncp-k8s-api-server status

    Example:

    kubenode> get ncp-k8s-api-server status
    Kubernetes ApiServer status: Healthy
  • Show the watcher status for ingress, namespace, pod, and service

    get ncp-watcher <watcher-name>
    get ncp-watchers

    Example 1:

    kubenode> get ncp-watcher pod
        Average event processing time: 1174 msec (in past 3600-sec window)
        Current watcher started time: Mar 02 2017 10:47:35 PST
        Number of events processed: 1 (in past 3600-sec window)
        Total events processed by current watcher: 1
        Total events processed since watcher thread created: 1
        Total watcher recycle count: 0
        Watcher thread created time: Mar 02 2017 10:47:35 PST
        Watcher thread status: Up

    Example 2:

    kubenode> get ncp-watchers
        pod:
            Average event processing time: 1145 msec (in past 3600-sec window)
            Current watcher started time: Mar 02 2017 10:51:37 PST
            Number of events processed: 1 (in past 3600-sec window)
            Total events processed by current watcher: 1
            Total events processed since watcher thread created: 1
            Total watcher recycle count: 0
            Watcher thread created time: Mar 02 2017 10:51:37 PST
            Watcher thread status: Up
     
        namespace:
            Average event processing time: 68 msec (in past 3600-sec window)
            Current watcher started time: Mar 02 2017 10:51:37 PST
            Number of events processed: 2 (in past 3600-sec window)
            Total events processed by current watcher: 2
            Total events processed since watcher thread created: 2
            Total watcher recycle count: 0
            Watcher thread created time: Mar 02 2017 10:51:37 PST
            Watcher thread status: Up
     
        ingress:
            Average event processing time: 0 msec (in past 3600-sec window)
            Current watcher started time: Mar 02 2017 10:51:37 PST
            Number of events processed: 0 (in past 3600-sec window)
            Total events processed by current watcher: 0
            Total events processed since watcher thread created: 0
            Total watcher recycle count: 0
            Watcher thread created time: Mar 02 2017 10:51:37 PST
            Watcher thread status: Up
     
        service:
            Average event processing time: 3 msec (in past 3600-sec window)
            Current watcher started time: Mar 02 2017 10:51:37 PST
            Number of events processed: 1 (in past 3600-sec window)
            Total events processed by current watcher: 1
            Total events processed since watcher thread created: 1
            Total watcher recycle count: 0
            Watcher thread created time: Mar 02 2017 10:51:37 PST
            Watcher thread status: Up

Cache Commands for the NCP Container

  • Get the internal cache for projects or namespaces

    get project-cache <project-name>
    get project-caches
    get namespace-cache <namespace-name>
    get namespace-caches

    Example 1:

    kubenode> get project-cache default
        isolation:
            is_isolated: False
        logical-router: 8accc9cd-9883-45f6-81b3-0d1fb2583180
        logical-switch:
            id: 9d7da647-27b6-47cf-9cdb-6e4f4d5a356d
            ip_pool_id: 519ff57f-061f-4009-8d92-3e6526e7c17e
            subnet: 10.0.0.0/24
            subnet_id: f75fd64c-c7b0-4b42-9681-fc656ae5e435

    Example 2:

    kubenode> get project-caches
        default:
            isolation:
                is_isolated: False
            logical-router: 8accc9cd-9883-45f6-81b3-0d1fb2583180
            logical-switch:
                id: 9d7da647-27b6-47cf-9cdb-6e4f4d5a356d
                ip_pool_id: 519ff57f-061f-4009-8d92-3e6526e7c17e
                subnet: 10.0.0.0/24
                subnet_id: f75fd64c-c7b0-4b42-9681-fc656ae5e435
     
        kube-system:
            Isolation:
                is_isolated: False
            logical-router: 5032b299-acad-448e-a521-19d272a08c46
            logical-switch:
                id: 85233651-602d-445d-ab10-1c84096cc22a
                ip_pool_id: ab1c5b09-7004-4206-ac56-85d9d94bffa2
                subnet: 10.0.1.0/24
                subnet_id: 73e450af-b4b8-4a61-a6e3-c7ddd15ce751
  • Get the internal cache for pods

    get pod-cache <pod-name>
    get pod-caches

    Example 1:

    kubenode> get pod-cache nsx.default.nginx-rc-uq2lv
        cif_id: 2af9f734-37b1-4072-ba88-abbf935bf3d4
        gateway_ip: 10.0.0.1
        ingress_controller: False
        ip: 10.0.0.2/24
        labels:
            app: nginx        
        mac: 02:50:56:00:08:00
        port_id: d52c833a-f531-4bdf-bfa2-e8a084a8d41b
        vlan: 1

    Example 2:

    kubenode> get pod-caches
        nsx.default.nginx-rc-uq2lv:
            cif_id: 2af9f734-37b1-4072-ba88-abbf935bf3d4
            gateway_ip: 10.0.0.1
            ingress_controller: False
            ip: 10.0.0.2/24
            labels:
                app: nginx
            mac: 02:50:56:00:08:00
            port_id: d52c833a-f531-4bdf-bfa2-e8a084a8d41b
            vlan: 1
  • Get the internal cache for ingress

    get ingress caches

    Example:

    kubenode> get ingress-caches
        nsx.default.nginx-ingress-rc-host-ed3og: 10.192.162.201

Support Commands for the NCP Container

  • Save the NCP support bundle in the filestore

    The support bundle consists of the log files for all the containers in pods with the label tier:nsx-networking. The bundle file is in the tgz format and saved in the CLI default filestore directory /var/vmware/nsx/file-store. You can use the CLI file-store command to copy the bundle file to a remote site.

    get support-bundle file <filename>

    Example:

    kubenode>get support-bundle file foo
    Bundle file foo created in tgz format
    kubenode>copy file foo url scp://nicira@10.0.0.1:/tmp
  • Save the NCP logs in the filestore

    The log file is saved in the tgz format in the CLI default filestore directory /var/vmware/nsx/file-store. You can use the CLI file-store command to copy the bundle file to a remote site.

    get ncp-log file <filename>

    Example:

    kubenode>get ncp-log file foo
    Log file foo created in tgz format
  • Save the node agent logs in the filestore

    Save the node agent logs from one node or all the nodes. The logs are saved in the tgz format in the CLI default filestore directory /var/vmware/nsx/file-store. You can use the CLI file-store command to copy the bundle file to a remote site.

    get node-agent-log file <filename>
    get node-agent-log file <filename> <node-name>

    Example:

    kubenode>get node-agent-log file foo
    Log file foo created in tgz format

Status Commands for the NSX Node Agent Container

  • Show the connection status between the node agent and HyperBus on this node.

    get node-agent-hyperbus status

    Example:

    kubenode> get node-agent-hyperbus status
    HyperBus status: Healthy

Cache Commands for the NSX Node Agent Container

  • Get the internal cache for applications. Users can retrieve the cache for a specific application or all applications.

    get app-cache <app-name>
    get app-caches

    Example 1:

    kubenode> get app-cache cif104
        ip: 192.168.0.14/32
        mac: 50:01:01:01:01:14
        gateway_ip: 169.254.1.254/16
        vlan_id: 104

    Example 2:

    kubenode> get app-caches
        cif104:
            ip: 192.168.0.14/32
            mac: 50:01:01:01:01:14
            gateway_ip: 169.254.1.254/16
            vlan_id: 104

Status Commands for the NSX Kube-Proxy Container

  • Show the connection status between Kube Proxy and Kubernetes API Server

    get ncp-k8s-api-server status

    Example:

    kubenode> get kube-proxy-k8s-api-server status
    Kubernetes ApiServer status: Healthy
  • Show the Kube Proxy watcher status

    get kube-proxy-watcher <watcher-name>
    get kube-proxy-watchers

    Example 1:

    kubenode> get kube-proxy-watcher endpoint
        Average event processing time: 15 msec (in past 3600-sec window)
        Current watcher started time: May 01 2017 15:06:24 PDT
        Number of events processed: 90 (in past 3600-sec window)
        Total events processed by current watcher: 90
        Total events processed since watcher thread created: 90
        Total watcher recycle count: 0
        Watcher thread created time: May 01 2017 15:06:24 PDT
        Watcher thread status: Up

    Example 2:

    kubenode> get kube-proxy-watchers
        endpoint:
            Average event processing time: 15 msec (in past 3600-sec window)
            Current watcher started time: May 01 2017 15:06:24 PDT
            Number of events processed: 90 (in past 3600-sec window)
            Total events processed by current watcher: 90
            Total events processed since watcher thread created: 90
            Total watcher recycle count: 0
            Watcher thread created time: May 01 2017 15:06:24 PDT
            Watcher thread status: Up
    
         service:
            Average event processing time: 8 msec (in past 3600-sec window)
            Current watcher started time: May 01 2017 15:06:24 PDT
            Number of events processed: 2 (in past 3600-sec window)
            Total events processed by current watcher: 2
            Total events processed since watcher thread created: 2
            Total watcher recycle count: 0
            Watcher thread created time: May 01 2017 15:06:24 PDT
            Watcher thread status: Up
  • Dump OVS flows on a node

    dump ovs-flows

    Example:

    kubenode> dump ovs-flows
        NXST_FLOW reply (xid=0x4):
        cookie=0x0, duration=8.876s, table=0, n_packets=0, n_bytes=0, idle_age=8, priority=100,ip actions=ct(table=1)
        cookie=0x0, duration=8.898s, table=0, n_packets=0, n_bytes=0, idle_age=8, priority=0 actions=NORMAL
        cookie=0x0, duration=8.759s, table=1, n_packets=0, n_bytes=0, idle_age=8, priority=100,tcp,nw_dst=10.96.0.1,tp_dst=443 actions=mod_tp_dst:443
        cookie=0x0, duration=8.719s, table=1, n_packets=0, n_bytes=0, idle_age=8, priority=100,ip,nw_dst=10.96.0.10 actions=drop
        cookie=0x0, duration=8.819s, table=1, n_packets=0, n_bytes=0, idle_age=8, priority=90,ip,in_port=1 actions=ct(table=2,nat)
        cookie=0x0, duration=8.799s, table=1, n_packets=0, n_bytes=0, idle_age=8, priority=80,ip actions=NORMAL
        cookie=0x0, duration=8.856s, table=2, n_packets=0, n_bytes=0, idle_age=8, actions=NORMAL