# Certified Kubernetes Administrator (CKA) Practice Exam: Part 2

**Edit the Web Frontend Deployment to Expose the HTTP Port**

**In the `web` namespace, there is a deployment called `web-frontend`.**

**Edit this deployment so that the containers within its Pods expose port 80.**

**Linux**

```
kubectl config use-context acgk8s
kubectl config set-context --current --namespace=web
kubectl edit deployment -n web web-frontend
```

Add the following lines then save the file

<figure><img src="https://2666479439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLYaaERPa1yy1Qa8E1NQ%2Fuploads%2FvTPf0MOFO2qNudVr2q1C%2Fimage.png?alt=media&#x26;token=83778ba5-57e8-4f1b-a04d-99090ad2e212" alt=""><figcaption></figcaption></figure>

**Create a Service to Expose the Web Frontend Deployment's Pods Externally**

**Create a service called `web-frontend-svc` in the `web` namespace. This service should make the Pods from the `web-frontend` deployment in the `web` namespace reachable from outside the cluster.**

**External entities should be able to reach the service by contacting any node in the cluster on port 30080.**

**Linux**

```
vi web-frontend-svc.yml
```

**web-frontend-svc.yml**

```
apiVersion: v1
kind: Service
metadata:
   name: web-frontend-svc
   namespace: web
spec:
   type: NodePort
   selector:
      app: web-frontend
   ports:
   - protocol: TCP
     port: 80
     targetPort: 80
     nodePort: 30080
```

**Linux**

```
kubectl create -f web-frontend-svc.yml
```

**Scale Up the Web Frontend Deployment**

**Scale the `web-frontend` deployment in the `web` namespace up to `5` replicas.**

**Linux**

```
kubectl scale deployment web-frontend -n web --replicas=5
kubectl get deployment -n web
```

<figure><img src="https://2666479439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLYaaERPa1yy1Qa8E1NQ%2Fuploads%2FMdvIVXcVn3pLKgP39LqZ%2Fimage.png?alt=media&#x26;token=aee4b9e7-ce8a-4ec2-961f-5fa5e1ed4ecf" alt=""><figcaption></figcaption></figure>

**Create an Ingress That Maps to the New Service**

**Create an Ingress called `web-frontend-ingress` in the `web` namespace that maps to the `web-frontend-svc` service in the `web` namespace. The Ingress should map all requests on the `/` path.**

**Linux**

```
vi web-frontend-ingress.yml
```

**web-frontend-ingress.yml**

```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
   name: web-frontend-ingress
   namespace: web
spec:
   rules:
   - http:
        paths:
        - path: /
          pathType: Prefix
          backend:
             service:
                name: web-frontend-svc
                port:
                   number: 80
```

**Linux**

```
kubectl create -f web-frontend-ingress.yml
```


---

# 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://jeffgthompsons-organization.gitbook.io/yellow-team/training/cloud-guru/certified-kubernetes-administrator-cka/certified-kubernetes-administrator-cka-practice-exam-part-2.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.
