How to Setup LAMP stack on AWS EKS
EKS: Amazon Elastic Container Server for Kubernetes (EKS) is a managed service that allows us to run Kubernetes Cluster with needing to stand up or maintain own Kubernetes Control Plane.
Step 1- Clone Git repository
We need to clone the git repository, in order to download Apache, PHP, MySQL and PhpMyAdmin yaml file.
Run the following command on the Linux terminal.
Delete MySQL Deployment:
delete MySQL Service
Clone output would be like this
Once download finish, Change directory
Step 2- Create Apache,PHP,MySQL,PhpMyAdmin Deployment, Pod & Service:
Run the command below to create Apache & PHP deployment, pod and Service
To Create MySQL Deployment and Service runs following Command.
Create PhpMyAdmin pod and service.
Step-3: Validate created Deployment, Service and pods:
List deployment:
List Services:
**NAME** **TYPE** **CLUSTER-IP** **EXTERNAL-IP** **PORT(S)** **AGE**
kubernetes ClusterIP 10.100.0.1 443/TCP 12d
mysql-service NodePort 10.100.133.204 3306:30006/TCP 4m
phpmyadmin LoadBalancer 10.100.124.42 a923b8ce414c611e9a4580e9bc01181a-1306726413.us-east-1.elb.amazonaws.com 80:31136/TCP 4m
phpservice LoadBalancer 10.100.252.156 a145801e314c711e9878e0a7065e7328-1743249526.us-east-1.elb.amazonaws.com 80:30080/TCP 25s
Check running pods
**NAME** **READY** **STATUS** **RESTARTS** **AGE** **IP** **NODE** **NOMINATED NODE**
mysqldeploy-5c9dcc8c55-bhqrj 1/1 Running 0 15m 192.168.183.108 ip-192-168-170-141.ec2.internal
phpdeployment-7fc9485dbf-82tpn 1/1 Running 0 12m 192.168.86.181 ip-192-168-106-201.ec2.internal
phpmyadmin 1/1 Running 0 15m 192.168.167.172 ip-192-168-170-141.ec2.internal
Step -4: Test Apache, PHP and PhpMyAdmin access
Open browser and access PHPservice service external IP URL:
http://a145801e314c711e9878e0a7065e7328-1743249526.us-east-1.elb.amazonaws.com/Check phpinfo
http://a145801e314c711e9878e0a7065e7328-1743249526.us-east-1.elb.amazonaws.com/phpinfo.phpTest PhpMyAdmin login
http://a923b8ce414c611e9a4580e9bc01181a-1306726413.us-east-1.elb.amazonaws.com/User: root
Password: redhat // We setup MySQL root password in our Mysql.yaml deployment file.//
We have successfully setup LAMP stack on EKS Kubernetes cluster.
-----------------------------------------------------------------------------------------------------------------------
Optional: Once you have done with LAB, you can delete Service and Deployment.
Delete PHP Deployment:
Delete MySQL Deployment:
delete PHP Service
delete MySQL Service
Delete PhpMyAdmin Service
Delete PhpMyAdmin pod
We have successfully deleted all the deployment, service and pods