# 사전 준비

이번 실습의 샘플 애플리케이션으로 Helm을 통하여 Wordpress 사이트를 배포합니다. 이 Helm 차트는 MariaDB 및 Wordpress를 배포하고 ELB를 통해 사이트에 액세스할 수 있는 엔드포인트를 구성합니다. 또한 로드 테스트 도구를 사용하여 Wordpress 구조의 다양한 URL을 검색하여 다수의 동시 연결을 통해 추가 네트워크 트래픽 로드를 생성할 수 있습니다.

이번 실습에서는 아래 tools를 사용하게 됩니다.

* **Helm**: Wordpress 애플리케이션 설치
* **CloudWatch Container Insights**: 클러스터로 부터 logs and metrics 을 수집
* **Siege**: 부하 테스
* **CloudWatch Container Insights Dashboard**: 컨테이너 성능 및 로드를 시각

## 1. Wordpress 설치하기

[bitnami charts repository](https://github.com/bitnami/charts) 통하여 Wordpress를 설치합니다.

Wordpress와 데이터베이스를 설치합니다.

```
# Create a namespace wordpress
kubectl create namespace wordpress-cwi

# Add the bitnami Helm Charts Repository
helm repo add bitnami https://charts.bitnami.com/bitnami

# Deploy WordPress in its own namespace
helm -n wordpress-cwi install understood-zebu bitnami/wordpress

```

Helm chart를 통해서 아래 구성요소가 생성됩니다.

* 2개 [persistent volumes claims](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)..
* 다수 [secrets](https://kubernetes.io/docs/concepts/configuration/secret/).
* 1개 [StatefulSet](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/) for MariaDB.
* 1개 [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) for Wordpress.

&#x20;아래 명령어를 통하여 배포 상태를 확인합니다.

```
kubectl -n wordpress-cwi rollout status deployment understood-zebu-wordpress

```

## 2. Wordpress에 접근하기

아래 명령어를 수행하여 Wordpress 사이트에 접속할 수 있는 URL을 확인합니다.

```
export SERVICE_URL=$(kubectl get svc -n wordpress-cwi understood-zebu-wordpress --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")

echo "Public URL: http://$SERVICE_URL/"

```

![](https://1998608250-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhByD5wv8eUbA5ZbUY5%2F-MhOh_EqcFZLJwN7rvnn%2F-MhOlPq8MPnoSQN1E11B%2Fimage.png?alt=media\&token=93e82c80-2db5-4c10-b4c9-4e8e2289b509)

Admin interface를 테스합니다.

```
export ADMIN_URL="http://$SERVICE_URL/admin"
export ADMIN_PASSWORD=$(kubectl get secret --namespace wordpress-cwi understood-zebu-wordpress -o jsonpath="{.data.wordpress-password}" | base64 --decode)

echo "Admin URL: http://$SERVICE_URL/admin
Username: user
Password: $ADMIN_PASSWORD
"

```

![](https://1998608250-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhByD5wv8eUbA5ZbUY5%2F-MhOh_EqcFZLJwN7rvnn%2F-MhOljPpaCDlByKNw08X%2Fimage.png?alt=media\&token=57524817-1086-43fb-b283-9e5a4f6672e3)

Admin URL을 브라우저에 열어 아래와 같은 결과를 확인합니다.

![](https://1998608250-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhByD5wv8eUbA5ZbUY5%2F-MhOh_EqcFZLJwN7rvnn%2F-MhOm5-j1s6FjnRW0aFd%2Fimage.png?alt=media\&token=5c6073dd-9f17-4a87-878d-073e7f0f57df)

위에서 확인한 username와 password로 접속하여 Wordpress가 정상적으로 동작하는지 확인합니다.

![](https://1998608250-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhByD5wv8eUbA5ZbUY5%2F-MhOh_EqcFZLJwN7rvnn%2F-MhOmT7sBqWy3_X80vSr%2Fimage.png?alt=media\&token=69f1d8dd-86ad-44f2-9d04-0bbec8b935dd)


---

# 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://wjlee81.gitbook.io/amazon-eks/container-insights/undefined.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.
