# Create Guard to Allow Ingress with IP/CIDR

Create guard to allow ingress with IP/CIDR used to make a CloudekaGuard which will allow incoming traffic to pods with certain labels from specified IP addresses or IP ranges (CIDR). Using this syntax, you can control incoming access to your web application from permitted IP addresses or IP ranges, and restrict that access based on specific rules. You can first run the following syntax to create a YAML file with the name allow-ingress-with-cidr.

```bash
nano allow-ingress-with-cidr.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:
  - fromCIDR:
    - 192.168.1.100/32
  - fromCIDRSet:
    - cidr: 192.168.0.0/16
      except:
      - 192.168.1.0/24
```

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-cidr.yaml
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudeka.ai/deka-gpu/deka-gpu-security/deka-guard/create-guard-to-allow-ingress-with-ip-cidr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
