我目前正在尝试将基于 calico 的集群迁移到新的 Dataplane V2,它基本上是托管的 Cilium 产品。对于本地测试,我运行安装了开源 cilium 的 k3d,并创建了一组 NetworkPolicies(k8s 原生策略,而不是 CiliumPolicies),它锁定所需的命名空间。
我当前的问题是,在 GKE 集群(启用了 DataPlane)上移植相同的策略时,这些相同的策略不起作用。
作为示例,让我们看一下某个应用程序和数据库之间的连接:
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: db-server.db-client
namespace: BAR
spec:
podSelector:
matchLabels:
policy.ory.sh/db: server
policyTypes:
- Ingress
ingress:
- ports: []
from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: FOO
podSelector:
matchLabels:
policy.ory.sh/db: client
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: db-client.db-server
namespace: FOO
spec:
podSelector:
matchLabels:
policy.ory.sh/db: client
policyTypes:
- Egress
egress:
- ports:
- port: 26257
protocol: TCP
to:
- namespaceSelector:
matchLabels: …Run Code Online (Sandbox Code Playgroud) google-cloud-platform kubernetes google-kubernetes-engine cilium kubernetes-networkpolicy