Skip to content

This is my implementation of k8s cluster using nginx, php-fpm, postgresql

Notifications You must be signed in to change notification settings

judimator/k8s-learn-and-experiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Docker-compose

  • Build images

    $ docker-compose build
  • Run containers

    $ docker-compose up -d
  • Install dependencies

    $ docker-compose exec php-fpm bash
    $ composer install
  • Open http://symfony.local

  • Enjoy!

K8s

  • Create Secret. Please note, the names of key and certificate should be "tls", i.e. tls.crt and tls.key
    $ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $(KEY) -out $(CERT) -subj "/CN=nginxsvc/O=nginxsvc"
    $ kubectl create secret tls nginx-crt --key $(KEY) --cert $(CERT)
    $ kubectl create secret generic app-secrets --from-env-file=k8s/secrets/.env.app.secrets
    $ kubectl create secret generic db-secrets --from-env-file=k8s/secrets/.env.db.secrets
  • Create ConfigMap:
    $ kubectl create configmap nginx --from-file=k8s/config/nginx/conf.d
    $ kubectl create configmap symfony.ini --from-file=k8s/config/php-fpm/conf.d/symfony.ini
    $ kubectl create configmap symfony.pool.conf --from-file=k8s/config/php-fpm/php-fpm.d/symfony.pool.conf
    $ kubectl create configmap nginx.conf --from-file=k8s/config/nginx/nginx.conf
    $ kubectl create configmap app-config --from-env-file=k8s/.env
  • Apply available k8 controllers:
    $ kubectl apply -f k8s/deployment.yaml
    $ kubectl apply -f k8s/service.yaml
    $ kubectl apply -f k8s/ingress.yaml
    $ kubectl apply -f k8s/statefulset.yaml
  • Verify the IP address is set:
    $ kubectl get ingress
  • Add the following line to the bottom of the /etc/hosts file:
     YOUR_ADDRESS symfony.localhost
    
  • Open http://symfony.local
  • Enjoy!

About

This is my implementation of k8s cluster using nginx, php-fpm, postgresql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published