contiv / netplugin

Container networking for various use cases
Apache License 2.0
513 stars 177 forks source link

K8s Network policy Support #1090

Open g1rana opened 6 years ago

g1rana commented 6 years ago

Description of the changes

This is feature commit to support K8s Network Policy at contiv. Using feature, Contiv will support K8s Ingress Network Policy however egress policy support comes in future code commit

Type of fix: New feature

Fixes #1089

Please describe:

kubectl get netpol

NAME POD-SELECTOR AGE access-nginx app=nginx 6m

  1. Contiv system after k8s policy: netctl group ls Tenant Group Network IP Pool CfgdTag Policies Network profile

    default default default-net default default-group default-net ingress-policy,access-nginx

  2. Bringup Ingress policy Pod and Src Pods :kubectl create -f nginx-deployment.yaml : kubectl create -f apod.yaml

kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE apod 1/1 Running 0 2m 10.233.64.8 k8s1 nginx-deployment-431080787-6b6zh 1/1 Running 0 2m 10.233.64.7 k8s1 nginx-deployment-431080787-9d949 1/1 Running 0 2m 10.233.64.6 k8s1

netctl policy rule-ls access-nginx Incoming Rules: Rule Priority From EndpointGroup From Network From IpAddress TO IpAddress Protocol Port Action


access-nginx-10.233.64.6-10.233.64.8 2 10.233.64.8 10.233.64.6 0 allow access-nginx-10.233.64.7-10.233.64.8 2 10.233.64.8 10.233.64.7 0 allow Outgoing Rules: Rule Priority To EndpointGroup To Network To IpAddress Protocol Port Action


====

g1rana commented 6 years ago

@eng-contiv

lihezhong93 commented 6 years ago

After creating EPG, are the spec pods updated to belong to this EPG? If not,will the flow table of ovs install this policy?