Git Product home page Git Product logo

statefulsets-wordpress-and-mysql's Introduction

WordPress and MySQL on Kubernetes

This project demonstrates the deployment of WordPress and MySQL on Kubernetes using StatefulSets. WordPress relies on MySQL as its backend, and the stateful nature of StatefulSets ensures stable storage and network identities for these applications.

Table of Contents

Prerequisites

  • A running Kubernetes cluster
  • kubectl command-line tool configured to communicate with the cluster
  • Basic understanding of Kubernetes concepts

Project Structure

  • mysql-pv-pvc.yaml: Defines PersistentVolume (PV) and PersistentVolumeClaim (PVC) for MySQL.
  • mysql-statefulset.yaml: Deploys MySQL as a StatefulSet.
  • mysql-service.yaml: Creates a Headless Service for MySQL.
  • wordpress-pv-pvc.yaml: Defines PV and PVC for WordPress.
  • wordpress-statefulset.yaml: Deploys WordPress as a StatefulSet.
  • wordpress-service.yaml: Creates a Headless Service for WordPress.
  • LICENSE: MIT License file.

Deployment Steps

  1. Create MySQL PersistentVolume and PersistentVolumeClaim:

    kubectl apply -f mysql-pv-pvc.yaml
  2. Create MySQL StatefulSet:

    kubectl apply -f mysql-statefulset.yaml
  3. Create MySQL Headless Service:

    kubectl apply -f mysql-service.yaml
  4. Create WordPress PersistentVolume and PersistentVolumeClaim:

    kubectl apply -f wordpress-pv-pvc.yaml
  5. Create WordPress StatefulSet:

    kubectl apply -f wordpress-statefulset.yaml
  6. Create WordPress Headless Service:

    kubectl apply -f wordpress-service.yaml
  7. Access WordPress:

    Obtain the NodePort or LoadBalancer IP:

    kubectl get svc wordpress

    Visit the obtained IP in your browser to access the WordPress installation page.

Customization

  • Adjust resource requests and limits in StatefulSet configurations based on your environment.
  • Customize MySQL and WordPress environment variables in respective StatefulSet configurations.
  • Modify storage configurations in PV/PVC files to use cloud-based storage solutions or other storage classes.

Cleanup

To delete the deployed resources, run the following commands:

kubectl delete -f wordpress-service.yaml
kubectl delete -f wordpress-statefulset.yaml
kubectl delete -f wordpress-pv-pvc.yaml
kubectl delete -f mysql-service.yaml
kubectl delete -f mysql-statefulset.yaml
kubectl delete -f mysql-pv-pvc.yaml

License

This project is licensed under the MIT License - see the LICENSE file for details.

Conclusion

This project provides a robust example of deploying stateful applications on Kubernetes. Feel free to extend and modify it to suit your specific requirements and production environment.

statefulsets-wordpress-and-mysql's People

Contributors

kadimasum avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.