Giter Site home page Giter Site logo

laravel-kubernetes's Introduction

Laravel + Kubernetes

Crear namespaces

  • kubectl create namespace application-services
  • kubectl create namespace application-storage

Instalar bases de datos

helm repo add bitnami https://charts.bitnami.com/bitnami

helm install posgresql bitnami/postgresql --namespace application-storage

Despues de la ejecucion del comando debe poder ver en consola un texto similar, siguiendo los pasos especificados podremos obtener la informacion de usuario y contraseña

NAME: posgresql LAST DEPLOYED: Thu Mar 31 12:40:22 2022 NAMESPACE: application-storage STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: CHART NAME: postgresql CHART VERSION: 11.0.6 APP VERSION: 14.1.0

** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS names from within your cluster:

posgresql-postgresql.application-storage.svc.cluster.local - Read/Write connection

To get the password for "postgres" run:

export POSTGRES_PASSWORD=$(kubectl get secret --namespace application-storage posgresql-postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode)

To connect to your database run the following command:

kubectl run posgresql-postgresql-client --rm --tty -i --restart='Never' --namespace application-storage --image docker.io/bitnami/postgresql:14.1.0-debian-10-r80 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
  --command -- psql --host posgresql-postgresql -U postgres -d postgres -p 5432

To connect to your database from outside the cluster execute the following commands:

kubectl port-forward --namespace application-storage svc/posgresql-postgresql 5432:5432 &
PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgres -p 5432

helm install redis bitnami/redis --namespace application-storage

NAME: redis LAST DEPLOYED: Thu Mar 31 13:28:49 2022 NAMESPACE: application-storage STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: CHART NAME: redis CHART VERSION: 16.4.0 APP VERSION: 6.2.6

** Please be patient while the chart is being deployed **

Redis™ can be accessed on the following DNS names from within your cluster:

redis-master.application-storage.svc.cluster.local for read/write operations (port 6379)
redis-replicas.application-storage.svc.cluster.local for read-only operations (port 6379)

To get your password run:

export REDIS_PASSWORD=$(kubectl get secret --namespace application-storage redis -o jsonpath="{.data.redis-password}" | base64 --decode)

To connect to your Redis™ server:

  1. Run a Redis™ pod that you can use as a client:

    kubectl run --namespace application-storage redis-client --restart='Never' --env REDIS_PASSWORD=$REDIS_PASSWORD --image docker.io/bitnami/redis:6.2.6-debian-10-r120 --command -- sleep infinity

    Use the following command to attach to the pod:

    kubectl exec --tty -i redis-client
    --namespace application-storage -- bash

  2. Connect using the Redis™ CLI: REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-master REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-replicas

To connect to your database from outside the cluster execute the following commands:

kubectl port-forward --namespace application-storage svc/redis-master : &
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p

Personalizar las variables de entornos en el archivo kustomization.yaml en el perfil production

En esta seccion es requerido mapear los respectivos datos de cofiguracion acorde a la informacion proprcionada para accesos a bases de datos (postgres/mysql y redis)

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.