{"id":28382992,"url":"https://github.com/kartikk-26/wordpress-deployment-on-k8s","last_synced_at":"2025-07-25T20:10:14.552Z","repository":{"id":284873479,"uuid":"956337929","full_name":"Kartikk-26/WordPress-Deployment-on-K8s","owner":"Kartikk-26","description":"This repository showcases the deployment of a WordPress application with a MySQL database on a Kubernetes cluster using kubeadm, with secure communication and seamless scaling. 🚀","archived":false,"fork":false,"pushed_at":"2025-03-28T05:00:08.000Z","size":1266,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T07:42:02.801Z","etag":null,"topics":["devops","kubectl-plugins","kubernetes-cluster","mysql","services"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kartikk-26.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-28T04:51:06.000Z","updated_at":"2025-03-28T05:45:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"74af360d-b121-4a08-a1c4-060340ad5052","html_url":"https://github.com/Kartikk-26/WordPress-Deployment-on-K8s","commit_stats":null,"previous_names":["kartikk-26/wordpress-deployment-on-k8s"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Kartikk-26/WordPress-Deployment-on-K8s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kartikk-26%2FWordPress-Deployment-on-K8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kartikk-26%2FWordPress-Deployment-on-K8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kartikk-26%2FWordPress-Deployment-on-K8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kartikk-26%2FWordPress-Deployment-on-K8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kartikk-26","download_url":"https://codeload.github.com/Kartikk-26/WordPress-Deployment-on-K8s/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kartikk-26%2FWordPress-Deployment-on-K8s/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267054886,"owners_count":24028389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","kubectl-plugins","kubernetes-cluster","mysql","services"],"created_at":"2025-05-30T05:11:35.845Z","updated_at":"2025-07-25T20:10:14.538Z","avatar_url":"https://github.com/Kartikk-26.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⚓️ WordPress Deployment on Kubernetes Cluster\n\nThis project demonstrates the deployment of a **WordPress application** with a **MySQL database** on a Kubernetes cluster using `kubeadm`. It covers the setup of namespaces, deployments, services, and ConfigMaps to ensure a smooth and secure deployment.\n\n---\n\n## 📚 Project Overview\n\n### 1. ✅ Launching EC2 Instances\n- Launched **3 EC2 instances** using `t2.medium` type.\n- OS: **Ubuntu 22.04 LTS**\n\n### 2. ⚡ Kubernetes Cluster Setup\n- Set up the Kubernetes cluster using [`kubeadm`](https://github.com/Aareez01/kubernetes-v1.30.2-cluster-using-kubeadm).\n- Followed steps to install Kubernetes v1.30.2 and configure the control plane and worker nodes.\n\n---\n\n## 🎯 Expected Outcomes\n- ✅ Successful deployment of WordPress and MySQL on a Kubernetes cluster.\n- ✅ Proper configuration of namespaces, deployments, services, and ConfigMaps.\n- ✅ Secure and seamless communication between WordPress and MySQL using Kubernetes services.\n- ✅ WordPress accessible via the public IP or domain on port 30080 using NodePort.\n- ✅ Hands-on experience in managing containerized applications and using kubeadm for cluster setup.\n- ✅ Done! WordPress is now successfully deployed on your Kubernetes cluster! 🎉\n![Image2](/Deployed%20Website%20-2.png) \n\n---\n\n## 🎯 Objective\nTo deploy a WordPress application connected to a MySQL database using Kubernetes, ensuring secure communication and scalability.\n\n---\n\n## ⚙️ Kubernetes Configuration\n\n### 1. 🗂️ Create Namespace\n```bash\nkubectl create ns mywebsite\n```\n\n### 2. 🛢️ MySQL Deployment\nCreate a `mysql.yaml` file:\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: mysql\n  namespace: mywebsite\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: mysql\n  template:\n    metadata:\n      labels:\n        app: mysql\n    spec:\n      containers:\n      - name: db\n        image: mysql\n        env:\n        - name: MYSQL_ROOT_PASSWORD\n          value: \"redhat\"\n        - name: MYSQL_DATABASE\n          value: \"bigdata\"\n```\n\n### 3. 🧩 MySQL Service (ClusterIP)\n```bash\nkubectl expose deployment -n mywebsite mysql --port 3306 --target-port 3306 --name=mysql-svc\n```\n\n---\n\n### 4. 🌐 WordPress Deployment\nCreate a `wordpress.yaml` file:\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: wordpress\n  namespace: mywebsite\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: wordpress\n  template:\n    metadata:\n      labels:\n        app: wordpress\n    spec:\n      containers:\n      - name: wp\n        image: wordpress\n        env:\n        - name: WORDPRESS_DB_HOST\n          value: \"10.96.164.193\"\n        - name: WORDPRESS_DB_USER\n          value: \"root\"\n        - name: WORDPRESS_DB_PASSWORD\n          value: \"redhat\"\n        - name: WORDPRESS_DB_NAME\n          value: \"bigdata\"\n```\n\n### 5. 🌐 WordPress Service (NodePort)\nCreate `wp-svc.yaml`:\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: wp-svc\n  namespace: mywebsite\nspec:\n  selector:\n    app: wordpress\n  type: NodePort\n  ports:\n  - protocol: TCP\n    port: 80\n    targetPort: 80\n    nodePort: 30080\n```\n\n---\n\n## ⚡ Access WordPress in Browser\n```bash\nhttp://\u003cEC2_PUBLIC_IP\u003e:30080\n```\n\n---\n\n## 🛠️ ConfigMap for Environment Variables\n\n### 1. 📄 Create MySQL ConfigMap\n```bash\nkubectl create configmap app-db --from-literal=MYSQL_ROOT_PASSWORD=redhat --from-literal=MYSQL_DATABASE=bigdata -n mywebsite\n```\n\n### 2. 📄 Create WordPress ConfigMap\n```bash\nkubectl create configmap app-wp -n mywebsite \\\n  --from-literal=WORDPRESS_DB_HOST=10.110.46.197 \\\n  --from-literal=WORDPRESS_DB_USER=root \\\n  --from-literal=WORDPRESS_DB_PASSWORD=redhat \\\n  --from-literal=WORDPRESS_DB_NAME=bigdata\n```\n\n---\n\n## 🚀 Using ConfigMap in Deployment\n\nModify the environment section of your deployment file to reference the ConfigMap:\n```yaml\nenvFrom:\n  - configMapRef:\n      name: app-db\n  - configMapRef:\n      name: app-wp\n```\n\n---\n\n## 📡 Verifying Deployment\n1. Check if all pods are running:\n```bash\nkubectl get pods -n mywebsite\n```\n2. Verify services:\n```bash\nkubectl get svc -n mywebsite\n```\n3. Access WordPress via browser:\n```\nhttp://\u003cEC2_PUBLIC_IP\u003e:30080\n```\n\n---\n\n## 📝 Conclusion\n- ✅ Successfully deployed a WordPress application with a MySQL backend on a Kubernetes cluster.  \n- ✅ Used ConfigMaps to manage configuration, ensuring application portability and better management.\n\n---\n## 📢 Let's Connect!\n- Stay updated on [LinkedIn](https://www.linkedin.com/in/-kartikjain/) for more DevOps projects and insights.\n- Follow along as I explore **Cloud Infrastructure, Ansible Automation, and DevOps practices**.\n- Let's collaborate and build scalable solutions together!\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkartikk-26%2Fwordpress-deployment-on-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkartikk-26%2Fwordpress-deployment-on-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkartikk-26%2Fwordpress-deployment-on-k8s/lists"}