$ kubectl get networkpolicystats -A Error from server (BadRequest): Unable to list "stats.antrea.tanzu.vmware.com/v1alpha1, Resource=networkpolicystats": feature NetworkPolicyStats disabled
To work around this issue, you need to enable collecting and exposing NetworkPolicy statistics,. To do this, you need to edit the Antrea configmap and enable NetworkPolicyStats.
1. Edit the configmap with below command:
kubectl edit configmap -n kube-system antrea-config-xxxx
2. Make the change NetworkPolicyStats: false to NetworkPolicyStats: true in the Section antrea-agent.conf and antrea-controller.conf.
3. When finished, save the configuration (esc, :wq) and restart the Antrea pods with this command:
kubectl delete pods -n kube-system --selector app=antrea
4. Check if Controller and Agents are up and running with below command:
kubectl get pods -n kube-system --selector app=antrea
Note: The NetworkPolicyStats shows to be FALSE when the service instance VMs are recreated.