Kubernetes
action Network

# create_network_policy

Add a network policty

Run it now
View details

Type | action
Module | chaosk8s.networking.actions
Name | create_network_policy
Return | none

Usage

JSON

    {
      "name": "create-network-policy",
      "type": "action",
      "provider": {
        "type": "python",
        "module": "chaosk8s.networking.actions",
        "func": "create_network_policy"
      }
    }

YAML

    name: create-network-policy
    provider:
      func: create_network_policy
      module: chaosk8s.networking.actions
      type: python
    type: action

Arguments

Name | Type | Default | Required | Title | Description
--- | --- | --- | --- | --- | ---
ns | string | ”default” | Yes | Namespace |
spec | mapping | null | No | Network Policy Specification | JSON payload of a Kubernetes network policy
spec_path | string | null | No | Network Policy Specification File | Path to a YAML/JSON file containing a Kubernetes network policy. Either this one or the one above.

Create a network policy in the given namespace either from the definition as `spec` or from a file containing the definition at `spec_path`.

Signature

    def create_network_policy(spec: Dict[str, Any] = None,
                              spec_path: str = None,
                              ns: str = 'default',
                              secrets: Dict[str, Dict[str, str]] = None):
        pass

## Related starters

- Kubernetes
  action Network

  ## `corrupt_packets`

  Corrupt packets on a Pod network link
- Kubernetes
  action Network

  ## `set_bandwidth`

  Simulate bandwith on a Pod network link
- Kubernetes
  action Network

  ## `remove_network_policy`

  Remove a network policty