> For the complete documentation index, see [llms.txt](https://docs.cloudeka.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudeka.ai/deka-gpu/deka-gpu-security/deka-guard/create-guard-to-allow-ingress-with-port.md).

# Create Guard to Allow Ingress with port

Create guard to allow ingress with a port is used to create a CloudekaGuard that will allow ingress traffic to pods with certain labels from pods with other labels that are in different namespaces, and only on certain ports. Using this syntax, you can control inbound access to your web application from permitted clients, and limit that access to only specified ports. You can first run the following syntax to create a YAML file with the name allow-ingress-with-port.

```bash
nano allow-ingress-with-port.yaml
```

Copy and paste the following YAML contents.

```yaml
apiVersion: tenants.cloudeka.ai/v1alpha2
kind: CloudekaGuard
metadata:
  name: allow-ingress-with-port
  namespace: ns1
spec:
  endpointSelector:
    matchLabels:
      app: web-app
  ingress:
  - fromEndpoints:
    - matchLabels:
        app: client-default
    toPorts:
    - ports:
      - port: "8080"
        protocol: TCP
```

After pasting the syntax, save the file by pressing Ctrl + O, then press the Enter key and exit the editor by pressing Ctrl + X. The next step is to apply Cloudeka Guard.

```bash
kubectl apply -f allow-ingress-with-port.yaml
```
