github.phpd.cn/cilium/cilium@v1.6.12/examples/kubernetes-ingress/network-policy/guestbook-policy-redis.json (about)

     1  {
     2    "apiVersion": "networking.k8s.io/v1",
     3    "kind": "NetworkPolicy",
     4    "metadata": {
     5      "name": "guestbook-redis"
     6    },
     7    "spec": {
     8      "podSelector": {
     9        "matchLabels": {
    10          "k8s-app.guestbook": "redis"
    11        }
    12      },
    13      "ingress": [
    14        {
    15          "from": [
    16            {
    17              "podSelector": {
    18                "matchLabels": {
    19                  "k8s-app.guestbook": "web"
    20                }
    21              }
    22            },
    23            {
    24              "podSelector": {
    25                "matchLabels": {
    26                  "k8s-app.guestbook": "redis"
    27                }
    28              }
    29            }
    30          ],
    31          "ports": [
    32            {
    33              "protocol": "TCP",
    34              "port": 6379
    35            }
    36          ]
    37        }
    38      ]
    39    }
    40  }