|
14 | 14 | 2. For Minikube:
|
15 | 15 |
|
16 | 16 | ```sh
|
| 17 | + # For Horizontal Pod Autoscaling |
17 | 18 | minikube addons enable metric-server
|
| 19 | + |
| 20 | + # For Nginx Ingress Controller |
| 21 | + # Install |
| 22 | + minikube addons enable ingress |
| 23 | + # Verify |
| 24 | + kubectl get pods -n ingress-nginx |
18 | 25 | ```
|
19 | 26 |
|
20 | 27 | 3. For Kubernetes:
|
21 | 28 |
|
22 | 29 | ```sh
|
| 30 | + # Metric Server |
23 | 31 | kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
|
| 32 | +
|
| 33 | + # Ingress Controller |
| 34 | + # Install |
| 35 | + kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/cloud/deploy.yaml |
| 36 | + # Deploy with load balancer (GKE, AKS, EKS) |
| 37 | + kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/cloud/deploy.yaml |
| 38 | + # Validate |
| 39 | + kubectl get pods --all-namespaces -l app.kubernetes.io/name=ingress-nginx |
| 40 | + kubectl get services ingress-nginx-controller --namespace=ingress-nginx |
24 | 41 | ```
|
25 | 42 |
|
26 | 43 | 4. Run the command from the project root:
|
|
29 | 46 | make k8s-up
|
30 | 47 | ```
|
31 | 48 |
|
32 |
| -5. Run the load test script: |
| 49 | +## Load Testing |
| 50 | + |
| 51 | +1. Run the load test script: |
33 | 52 |
|
34 | 53 | ```sh
|
35 | 54 | ./scripts/k8s-load-test.sh
|
|
40 | 59 |
|
41 | 60 | Also, this will ping the service's `/health` endpoint, if configured. Else, it will not work.
|
42 | 61 |
|
43 |
| -6. Run the command: |
| 62 | +2. Run the command: |
44 | 63 |
|
45 | 64 | ```sh
|
46 | 65 | kubectl -n peerprep get all
|
|
49 | 68 | You should be able to see the Horizontal Pod AutoScaler scaling up the services in respond to
|
50 | 69 | resource demand.
|
51 | 70 |
|
52 |
| -7. Run <kbd>Ctrl</kbd>+<kbd>C</kbd> to interrupt and |
| 71 | +3. Run <kbd>Ctrl</kbd>+<kbd>C</kbd> to interrupt and |
53 | 72 | terminate the load tester.
|
| 73 | +
|
| 74 | +## Exposing the Ingress Controller |
| 75 | +
|
| 76 | +1. If you haven't already, run the command from the project root: |
| 77 | + |
| 78 | + ```sh |
| 79 | + make k8s-up |
| 80 | + ``` |
| 81 | + |
| 82 | +2. Run the command to set up the ingress controller: |
| 83 | + |
| 84 | + ```sh |
| 85 | + kubectl apply -f ./k8s/ingress/06-nginx-ingress.yaml |
| 86 | + ``` |
| 87 | + |
| 88 | +3. Run the command to expose the ingress controller: |
| 89 | + |
| 90 | + ```sh |
| 91 | + minikube tunnel |
| 92 | + ``` |
| 93 | + |
| 94 | +4. Edit your `/etc/hosts` file and add the following at the bottom: |
| 95 | + |
| 96 | + ```txt |
| 97 | + 127.0.0.1 peerprep-g16.net |
| 98 | + ``` |
| 99 | + |
| 100 | +5. Visit `http://peerprep-g16.net` in your browser. |
| 101 | + |
| 102 | +## Running the Minikube Service without Ingress |
| 103 | + |
| 104 | +1. Run the command to set up the cluster: |
| 105 | + |
| 106 | + ```sh |
| 107 | + make k8s-up |
| 108 | + ``` |
| 109 | + |
| 110 | +2. Expose the service: |
| 111 | + |
| 112 | + ```sh |
| 113 | + minikube -n peerprep service frontend |
| 114 | + ``` |
| 115 | + |
| 116 | + A browser window should launch, directing you to the application's frontend. |
0 commit comments