How to apply Calico GlobalNetworkPolicy

#1

Dear Experts,

I have Rancher managing a Kubernetes cluster. The cluster has Calico CNI. Now I want to use Calico GlobalNetworkPolicy. How ca I apply it. The common approach with kubectl create … doesn’t work:

kubectl create -f - <<EOT
apiVersion: projectcalico.org/v3
kind: GlobalNetworkPolicy
metadata:
  name: Deny-Egress
spec:
  selector: noegress == 'y'
  types:
  - Egress
  egress:
  - action: Deny
EOT

ends up with this error:

error: unable to recognize "STDIN": no matches for kind "GlobalNetworkPolicy" in version "projectcalico.org/v3"

Do you have any idea, how I can apply this policy?
Thank You very much.

#2

I could solve this Problem on my own: for applying calico policies the utiliti calicoctl can be used.