From 44323b131a717bdc72a3d66df32790a333da2749 Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 11:17:55 +0100 Subject: [PATCH 01/30] adding ci-cd --- .github/workflows/ci-cd-pipeline.yml | 52 +++++++++++++++++++++++++++ k8s/ingress/ingress.yaml | 0 k8s/postgres/postgres-deployment.yaml | 0 k8s/postgres/postgres-pvc.yaml | 0 k8s/postgres/postgres-service.yaml | 0 k8s/redis/redis-deployment.yaml | 0 k8s/redis/redis-pvc.yaml | 0 k8s/redis/redis-service.yaml | 0 k8s/result/result-deployment.yaml | 0 k8s/result/result-service.yaml | 0 k8s/vote/vote-deployment.yaml | 0 k8s/vote/vote-service.yaml | 0 k8s/worker/worker-deployment.yaml | 0 k8s/worker/worker-service.yaml | 0 14 files changed, 52 insertions(+) create mode 100644 .github/workflows/ci-cd-pipeline.yml create mode 100644 k8s/ingress/ingress.yaml create mode 100644 k8s/postgres/postgres-deployment.yaml create mode 100644 k8s/postgres/postgres-pvc.yaml create mode 100644 k8s/postgres/postgres-service.yaml create mode 100644 k8s/redis/redis-deployment.yaml create mode 100644 k8s/redis/redis-pvc.yaml create mode 100644 k8s/redis/redis-service.yaml create mode 100644 k8s/result/result-deployment.yaml create mode 100644 k8s/result/result-service.yaml create mode 100644 k8s/vote/vote-deployment.yaml create mode 100644 k8s/vote/vote-service.yaml create mode 100644 k8s/worker/worker-deployment.yaml create mode 100644 k8s/worker/worker-service.yaml diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml new file mode 100644 index 00000000..2a5c1e4b --- /dev/null +++ b/.github/workflows/ci-cd-pipeline.yml @@ -0,0 +1,52 @@ +name: CI/CD to EKS + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and Push Vote + run: | + cd vote + docker build -t ${{ secrets.DOCKER_USERNAME }}/vote:latest . + docker push ${{ secrets.DOCKER_USERNAME }}/vote:latest + + - name: Build and Push Result + run: | + cd result + docker build -t ${{ secrets.DOCKER_USERNAME }}/result:latest . + docker push ${{ secrets.DOCKER_USERNAME }}/result:latest + + - name: Build and Push Worker + run: | + cd worker + docker build -t ${{ secrets.DOCKER_USERNAME }}/worker:latest . + docker push ${{ secrets.DOCKER_USERNAME }}/worker:latest + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: sa-east-1 + + - name: Update kubeconfig for EKS + run: | + aws eks update-kubeconfig --name YOUR-CLUSTER-NAME --region us-east-1 + + - name: Deploy to EKS + run: kubectl apply -f k8s/ diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/postgres/postgres-deployment.yaml b/k8s/postgres/postgres-deployment.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/postgres/postgres-pvc.yaml b/k8s/postgres/postgres-pvc.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/postgres/postgres-service.yaml b/k8s/postgres/postgres-service.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/redis/redis-deployment.yaml b/k8s/redis/redis-deployment.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/redis/redis-pvc.yaml b/k8s/redis/redis-pvc.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/redis/redis-service.yaml b/k8s/redis/redis-service.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/result/result-deployment.yaml b/k8s/result/result-deployment.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/result/result-service.yaml b/k8s/result/result-service.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/vote/vote-deployment.yaml b/k8s/vote/vote-deployment.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/vote/vote-service.yaml b/k8s/vote/vote-service.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/worker/worker-deployment.yaml b/k8s/worker/worker-deployment.yaml new file mode 100644 index 00000000..e69de29b diff --git a/k8s/worker/worker-service.yaml b/k8s/worker/worker-service.yaml new file mode 100644 index 00000000..e69de29b From 383b7d9b06a5af128506a4e8ded84bf51801bb4b Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 15:11:52 +0100 Subject: [PATCH 02/30] adding cluster --- .github/workflows/ci-cd-pipeline.yml | 22 ++++++---- infra/eks/cluster.yaml | 29 +++++++++++++ k8s/ingress/ingress.yaml | 30 +++++++++++++ k8s/postgres/postgres-deployment.yaml | 62 +++++++++++++++++++++++++++ k8s/postgres/postgres-pvc.yaml | 11 +++++ k8s/postgres/postgres-service.yaml | 12 ++++++ k8s/redis/redis-deployment.yaml | 54 +++++++++++++++++++++++ k8s/redis/redis-pvc.yaml | 10 +++++ k8s/redis/redis-service.yaml | 12 ++++++ k8s/result/result-deployment.yaml | 51 ++++++++++++++++++++++ k8s/result/result-service.yaml | 12 ++++++ k8s/vote/vote-deployment.yaml | 37 ++++++++++++++++ k8s/vote/vote-service.yaml | 12 ++++++ k8s/worker/worker-deployment.yaml | 47 ++++++++++++++++++++ k8s/worker/worker-service.yaml | 8 ++++ 15 files changed, 401 insertions(+), 8 deletions(-) create mode 100644 infra/eks/cluster.yaml diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index 2a5c1e4b..2e266c28 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -1,4 +1,4 @@ -name: CI/CD to EKS +name: CI/CD Pipeline on: push: @@ -8,6 +8,9 @@ on: jobs: build-and-deploy: runs-on: ubuntu-latest + permissions: + id-token: write # For AWS OIDC + contents: read steps: - name: Checkout code @@ -40,13 +43,16 @@ jobs: - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: sa-east-1 + role-to-assume: arn:aws:iam::YOUR_ACCOUNT_ID:role/github-actions-eks-role + aws-region: ${{ secrets.AWS_REGION }} - - name: Update kubeconfig for EKS + - name: Install eksctl run: | - aws eks update-kubeconfig --name YOUR-CLUSTER-NAME --region us-east-1 + curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp + sudo mv /tmp/eksctl /usr/local/bin - - name: Deploy to EKS - run: kubectl apply -f k8s/ + - name: Update Kubeconfig + run: eksctl utils write-kubeconfig --cluster YOUR-CLUSTER-NAME --region us-east-1 + + - name: Deploy Kubernetes Manifests + run: kubectl apply -f k8s/ # Asumiendo que tus YAMLs están en carpeta k8s/ \ No newline at end of file diff --git a/infra/eks/cluster.yaml b/infra/eks/cluster.yaml new file mode 100644 index 00000000..2e9fd68c --- /dev/null +++ b/infra/eks/cluster.yaml @@ -0,0 +1,29 @@ +apiVersion: eksctl.io/v1alpha5 +kind: ClusterConfig + +metadata: + name: voting-app-cluster + region: sa-east-1 # cambia si prefieres otra región (ej: eu-west-1) + version: "1.31" # o la versión más reciente soportada + +managedNodeGroups: + - name: standard-workers + instanceType: t2.small + minSize: 1 + maxSize: 3 + desiredCapacity: 2 + volumeSize: 30 + volumeType: gp3 + ssh: + allow: false + iam: + withAddonPolicies: + autoScaler: true + externalDNS: true + certManager: true + +addons: + - name: vpc-cni + - name: coredns + - name: kube-proxy + - name: aws-ebs-csi-driver \ No newline at end of file diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml index e69de29b..38affbaf 100644 --- a/k8s/ingress/ingress.yaml +++ b/k8s/ingress/ingress.yaml @@ -0,0 +1,30 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: voting-ingress + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" +spec: + ingressClassName: nginx + tls: + - hosts: + - example.com + secretName: voting-tls + rules: + - host: example.com + http: + paths: + - path: /vote + pathType: Prefix + backend: + service: + name: vote-service + port: + number: 80 + - path: /result + pathType: Prefix + backend: + service: + name: result-service + port: + number: 80 \ No newline at end of file diff --git a/k8s/postgres/postgres-deployment.yaml b/k8s/postgres/postgres-deployment.yaml index e69de29b..25a7b3e5 100644 --- a/k8s/postgres/postgres-deployment.yaml +++ b/k8s/postgres/postgres-deployment.yaml @@ -0,0 +1,62 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: postgres-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: postgres + template: + metadata: + labels: + app: postgres + spec: + containers: + - name: postgres + image: postgres:15-alpine + ports: + - containerPort: 5432 + env: + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: db-credentials + key: POSTGRES_PASSWORD + - name: POSTGRES_DB + value: votes + volumeMounts: + - mountPath: /var/lib/postgresql/data + name: postgres-data + volumes: + - name: postgres-data + persistentVolumeClaim: + claimName: postgres-pvc + +--- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: postgres-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi # ← Cambia a 5Gi (o el tamaño final que necesitas) + storageClassName: ebs-gp3 +--- + +apiVersion: v1 +kind: Service +metadata: + name: postgres-service +spec: + selector: + app: postgres + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 + type: ClusterIP \ No newline at end of file diff --git a/k8s/postgres/postgres-pvc.yaml b/k8s/postgres/postgres-pvc.yaml index e69de29b..0c5d47d3 100644 --- a/k8s/postgres/postgres-pvc.yaml +++ b/k8s/postgres/postgres-pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: postgres-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi # Ajusta a 5Gi si ya existe uno con ese tamaño (como en tu error anterior) + storageClassName: ebs-gp3 # O el StorageClass de tu cluster EKS (gp2 es común en AWS) \ No newline at end of file diff --git a/k8s/postgres/postgres-service.yaml b/k8s/postgres/postgres-service.yaml index e69de29b..04ac60c6 100644 --- a/k8s/postgres/postgres-service.yaml +++ b/k8s/postgres/postgres-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: postgres-service +spec: + selector: + app: postgres + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 + type: ClusterIP \ No newline at end of file diff --git a/k8s/redis/redis-deployment.yaml b/k8s/redis/redis-deployment.yaml index e69de29b..10261788 100644 --- a/k8s/redis/redis-deployment.yaml +++ b/k8s/redis/redis-deployment.yaml @@ -0,0 +1,54 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: redis + template: + metadata: + labels: + app: redis + spec: + containers: + - name: redis + image: redis:alpine + ports: + - containerPort: 6379 + volumeMounts: + - mountPath: /data + name: redis-data + volumes: + - name: redis-data + persistentVolumeClaim: + claimName: redis-pvc + +--- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- + +apiVersion: v1 +kind: Service +metadata: + name: redis-service +spec: + selector: + app: redis + ports: + - protocol: TCP + port: 6379 + targetPort: 6379 + type: ClusterIP \ No newline at end of file diff --git a/k8s/redis/redis-pvc.yaml b/k8s/redis/redis-pvc.yaml index e69de29b..81437e5b 100644 --- a/k8s/redis/redis-pvc.yaml +++ b/k8s/redis/redis-pvc.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi \ No newline at end of file diff --git a/k8s/redis/redis-service.yaml b/k8s/redis/redis-service.yaml index e69de29b..5d7dbf99 100644 --- a/k8s/redis/redis-service.yaml +++ b/k8s/redis/redis-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis-service +spec: + selector: + app: redis + ports: + - protocol: TCP + port: 6379 + targetPort: 6379 + type: ClusterIP \ No newline at end of file diff --git a/k8s/result/result-deployment.yaml b/k8s/result/result-deployment.yaml index e69de29b..766548e7 100644 --- a/k8s/result/result-deployment.yaml +++ b/k8s/result/result-deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: result-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: result + template: + metadata: + labels: + app: result + spec: + containers: + - name: result + image: cesarboada/result:latest # Use your Docker Hub image + ports: + - containerPort: 80 + env: + - name: PG_HOST + value: postgres-service + - name: PG_PORT + value: "5432" + - name: PG_USER + valueFrom: + secretKeyRef: + name: db-credentials + key: POSTGRES_USER + - name: PG_PASSWORD + valueFrom: + secretKeyRef: + name: db-credentials + key: POSTGRES_PASSWORD + - name: PG_DATABASE + value: votes + +--- + +apiVersion: v1 +kind: Service +metadata: + name: result-service +spec: + selector: + app: result + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: ClusterIP \ No newline at end of file diff --git a/k8s/result/result-service.yaml b/k8s/result/result-service.yaml index e69de29b..d02ef526 100644 --- a/k8s/result/result-service.yaml +++ b/k8s/result/result-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: result-service +spec: + selector: + app: result + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: ClusterIP \ No newline at end of file diff --git a/k8s/vote/vote-deployment.yaml b/k8s/vote/vote-deployment.yaml index e69de29b..bf727728 100644 --- a/k8s/vote/vote-deployment.yaml +++ b/k8s/vote/vote-deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vote-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: vote + template: + metadata: + labels: + app: vote + spec: + containers: + - name: vote + image: cesarboada/vote:latest # Use your Docker Hub image + ports: + - containerPort: 80 + env: + - name: REDIS_HOST + value: redis-service + +--- + +apiVersion: v1 +kind: Service +metadata: + name: vote-service +spec: + selector: + app: vote + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: ClusterIP \ No newline at end of file diff --git a/k8s/vote/vote-service.yaml b/k8s/vote/vote-service.yaml index e69de29b..2b29c545 100644 --- a/k8s/vote/vote-service.yaml +++ b/k8s/vote/vote-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: vote-service +spec: + selector: + app: vote + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: ClusterIP \ No newline at end of file diff --git a/k8s/worker/worker-deployment.yaml b/k8s/worker/worker-deployment.yaml index e69de29b..9df13612 100644 --- a/k8s/worker/worker-deployment.yaml +++ b/k8s/worker/worker-deployment.yaml @@ -0,0 +1,47 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: worker-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: worker + template: + metadata: + labels: + app: worker + spec: + containers: + - name: worker + image: cesarboada/worker:latest # Use your Docker Hub image + env: + - name: REDIS_HOST + value: redis-service + - name: REDIS_PORT + value: "6379" + - name: DB_HOST + value: postgres-service + - name: DB_USERNAME + valueFrom: + secretKeyRef: + name: db-credentials + key: POSTGRES_USER + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: db-credentials + key: POSTGRES_PASSWORD + - name: DB_NAME + value: votes + +--- + +apiVersion: v1 +kind: Service +metadata: + name: worker-service +spec: + selector: + app: worker + type: ClusterIP # Worker no necesita puerto externo \ No newline at end of file diff --git a/k8s/worker/worker-service.yaml b/k8s/worker/worker-service.yaml index e69de29b..70e90938 100644 --- a/k8s/worker/worker-service.yaml +++ b/k8s/worker/worker-service.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Service +metadata: + name: worker-service +spec: + selector: + app: worker + type: ClusterIP # No necesita puerto externo \ No newline at end of file From 3ab9a98ee0ac64518fc43f19af7a192f2df715ef Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 16:05:45 +0100 Subject: [PATCH 03/30] ci-cd modified --- .github/workflows/ci-cd-pipeline.yml | 6 +++--- infra/eks/cluster.yaml | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index 2e266c28..c12e8402 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -2,7 +2,7 @@ name: CI/CD Pipeline on: push: - branches: [ main ] + branches: [ latin ] workflow_dispatch: jobs: @@ -43,7 +43,7 @@ jobs: - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: - role-to-assume: arn:aws:iam::YOUR_ACCOUNT_ID:role/github-actions-eks-role + role-to-assume: arn:aws:iam::686699774218:role/github-actions-eks-role aws-region: ${{ secrets.AWS_REGION }} - name: Install eksctl @@ -52,7 +52,7 @@ jobs: sudo mv /tmp/eksctl /usr/local/bin - name: Update Kubeconfig - run: eksctl utils write-kubeconfig --cluster YOUR-CLUSTER-NAME --region us-east-1 + run: eksctl utils write-kubeconfig --cluster voting-app-cluster --region ${{ secrets.AWS_REGION }} - name: Deploy Kubernetes Manifests run: kubectl apply -f k8s/ # Asumiendo que tus YAMLs están en carpeta k8s/ \ No newline at end of file diff --git a/infra/eks/cluster.yaml b/infra/eks/cluster.yaml index 2e9fd68c..13daaa7b 100644 --- a/infra/eks/cluster.yaml +++ b/infra/eks/cluster.yaml @@ -26,4 +26,8 @@ addons: - name: vpc-cni - name: coredns - name: kube-proxy - - name: aws-ebs-csi-driver \ No newline at end of file + - name: aws-ebs-csi-driver + - name: eks-pod-identity-agent + +addonsConfig: + autoApplyPodIdentityAssociations: true \ No newline at end of file From 3d51b309ba9d0c1b6ca5a6de4c3d094a23fea063 Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 16:50:11 +0100 Subject: [PATCH 04/30] ci-cd modifiedv2 --- .github/workflows/ci-cd-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index c12e8402..36b168c9 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -55,4 +55,4 @@ jobs: run: eksctl utils write-kubeconfig --cluster voting-app-cluster --region ${{ secrets.AWS_REGION }} - name: Deploy Kubernetes Manifests - run: kubectl apply -f k8s/ # Asumiendo que tus YAMLs están en carpeta k8s/ \ No newline at end of file + run: kubectl apply -f k8s/ # Asumiendo que YAMLs están en carpeta k8s/ \ No newline at end of file From 6a9c02f710809ea8d43d35c5482cd63d7d5d6466 Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 17:07:14 +0100 Subject: [PATCH 05/30] ci-cd modifiedv3 --- .github/workflows/ci-cd-pipeline.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index 36b168c9..57cbcc28 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -54,5 +54,15 @@ jobs: - name: Update Kubeconfig run: eksctl utils write-kubeconfig --cluster voting-app-cluster --region ${{ secrets.AWS_REGION }} + - name: Add Node Role to aws-auth + run: | + eksctl create iamidentitymapping \ + --cluster voting-app-cluster \ + --region ${{ secrets.AWS_REGION }} \ + --arn arn:aws:iam::686699774218:role/eksctl-voting-app-cluster-nodegrou-NodeInstanceRole-aUKH0ibs5vnT \ + --username system:node:{{EC2PrivateDNSName}} \ + --group system:bootstrappers \ + --group system:nodes + - name: Deploy Kubernetes Manifests - run: kubectl apply -f k8s/ # Asumiendo que YAMLs están en carpeta k8s/ \ No newline at end of file + run: kubectl apply -f k8s/ # Asumiendo YAMLs están en carpeta k8s/ \ No newline at end of file From 0dd9c0e2637ce0a5011c85a6d327e09e08d22490 Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 17:27:37 +0100 Subject: [PATCH 06/30] ci-cd modifiedv4 --- .github/workflows/ci-cd-pipeline.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index 57cbcc28..e9b049b1 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -56,13 +56,18 @@ jobs: - name: Add Node Role to aws-auth run: | - eksctl create iamidentitymapping \ - --cluster voting-app-cluster \ - --region ${{ secrets.AWS_REGION }} \ - --arn arn:aws:iam::686699774218:role/eksctl-voting-app-cluster-nodegrou-NodeInstanceRole-aUKH0ibs5vnT \ - --username system:node:{{EC2PrivateDNSName}} \ - --group system:bootstrappers \ - --group system:nodes + aws eks update-kubeconfig \ + --name voting-app-cluster \ + --region ${{ secrets.AWS_REGION }} + kubectl patch configmap aws-auth -n kube-system --patch ' + data: + mapRoles: | + - rolearn: arn:aws:iam::686699774218:role/eksctl-voting-app-cluster-nodegrou-NodeInstanceRole-aUKH0ibs5vnT + username: system:node:{{EC2PrivateDNSName}} + groups: + - system:bootstrappers + - system:nodes + ' - name: Deploy Kubernetes Manifests run: kubectl apply -f k8s/ # Asumiendo YAMLs están en carpeta k8s/ \ No newline at end of file From 7d920c03f8935ca9aca392681a9f7fa73204a5cb Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 17:34:45 +0100 Subject: [PATCH 07/30] ci-cd modifiedv5 --- .github/workflows/ci-cd-pipeline.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index e9b049b1..cea8900a 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -54,20 +54,5 @@ jobs: - name: Update Kubeconfig run: eksctl utils write-kubeconfig --cluster voting-app-cluster --region ${{ secrets.AWS_REGION }} - - name: Add Node Role to aws-auth - run: | - aws eks update-kubeconfig \ - --name voting-app-cluster \ - --region ${{ secrets.AWS_REGION }} - kubectl patch configmap aws-auth -n kube-system --patch ' - data: - mapRoles: | - - rolearn: arn:aws:iam::686699774218:role/eksctl-voting-app-cluster-nodegrou-NodeInstanceRole-aUKH0ibs5vnT - username: system:node:{{EC2PrivateDNSName}} - groups: - - system:bootstrappers - - system:nodes - ' - - name: Deploy Kubernetes Manifests run: kubectl apply -f k8s/ # Asumiendo YAMLs están en carpeta k8s/ \ No newline at end of file From b051401191029eba03a539d5371da34cee5cec46 Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 17:43:37 +0100 Subject: [PATCH 08/30] ci-cd modifiedv6 --- .github/workflows/ci-cd-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index cea8900a..6f71b44b 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -55,4 +55,4 @@ jobs: run: eksctl utils write-kubeconfig --cluster voting-app-cluster --region ${{ secrets.AWS_REGION }} - name: Deploy Kubernetes Manifests - run: kubectl apply -f k8s/ # Asumiendo YAMLs están en carpeta k8s/ \ No newline at end of file + run: kubectl apply -R -f k8s/ # Asumiendo YAMLs están en carpeta k8s/ \ No newline at end of file From c40e022fec81541dfbde2f5ba0f416ca499d4184 Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 17:50:02 +0100 Subject: [PATCH 09/30] ci-cd modifiedv7 --- k8s/result/result-deployment.yaml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/k8s/result/result-deployment.yaml b/k8s/result/result-deployment.yaml index 766548e7..81804633 100644 --- a/k8s/result/result-deployment.yaml +++ b/k8s/result/result-deployment.yaml @@ -33,19 +33,4 @@ spec: name: db-credentials key: POSTGRES_PASSWORD - name: PG_DATABASE - value: votes - ---- - -apiVersion: v1 -kind: Service -metadata: - name: result-service -spec: - selector: - app: result - ports: - - protocol: TCP - port: 80 - targetPort: 80 - type: ClusterIP \ No newline at end of file + value: votes \ No newline at end of file From 2bee15766874f5fc5829bc5e872b784417eaac72 Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 17:54:57 +0100 Subject: [PATCH 10/30] ci-cd modifiedv8 --- k8s/vote/vote-deployment.yaml | 17 +---------------- k8s/worker/worker-deployment.yaml | 13 +------------ k8s/worker/worker-service.yaml | 8 -------- 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 k8s/worker/worker-service.yaml diff --git a/k8s/vote/vote-deployment.yaml b/k8s/vote/vote-deployment.yaml index bf727728..6842422c 100644 --- a/k8s/vote/vote-deployment.yaml +++ b/k8s/vote/vote-deployment.yaml @@ -19,19 +19,4 @@ spec: - containerPort: 80 env: - name: REDIS_HOST - value: redis-service - ---- - -apiVersion: v1 -kind: Service -metadata: - name: vote-service -spec: - selector: - app: vote - ports: - - protocol: TCP - port: 80 - targetPort: 80 - type: ClusterIP \ No newline at end of file + value: redis-service \ No newline at end of file diff --git a/k8s/worker/worker-deployment.yaml b/k8s/worker/worker-deployment.yaml index 9df13612..4310783e 100644 --- a/k8s/worker/worker-deployment.yaml +++ b/k8s/worker/worker-deployment.yaml @@ -33,15 +33,4 @@ spec: name: db-credentials key: POSTGRES_PASSWORD - name: DB_NAME - value: votes - ---- - -apiVersion: v1 -kind: Service -metadata: - name: worker-service -spec: - selector: - app: worker - type: ClusterIP # Worker no necesita puerto externo \ No newline at end of file + value: votes \ No newline at end of file diff --git a/k8s/worker/worker-service.yaml b/k8s/worker/worker-service.yaml deleted file mode 100644 index 70e90938..00000000 --- a/k8s/worker/worker-service.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: worker-service -spec: - selector: - app: worker - type: ClusterIP # No necesita puerto externo \ No newline at end of file From 8147d6c0edc5f7d87613d39802cf7678cd6865d8 Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 18:22:57 +0100 Subject: [PATCH 11/30] ci-cd modifiedv9 --- k8s/postgres/postgres-pvc.yaml | 2 +- k8s/redis/redis-pvc.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/k8s/postgres/postgres-pvc.yaml b/k8s/postgres/postgres-pvc.yaml index 0c5d47d3..0463d295 100644 --- a/k8s/postgres/postgres-pvc.yaml +++ b/k8s/postgres/postgres-pvc.yaml @@ -8,4 +8,4 @@ spec: resources: requests: storage: 5Gi # Ajusta a 5Gi si ya existe uno con ese tamaño (como en tu error anterior) - storageClassName: ebs-gp3 # O el StorageClass de tu cluster EKS (gp2 es común en AWS) \ No newline at end of file + storageClassName: gp3 # O el StorageClass de tu cluster EKS (gp2 es común en AWS) \ No newline at end of file diff --git a/k8s/redis/redis-pvc.yaml b/k8s/redis/redis-pvc.yaml index 81437e5b..708e9d56 100644 --- a/k8s/redis/redis-pvc.yaml +++ b/k8s/redis/redis-pvc.yaml @@ -5,6 +5,7 @@ metadata: spec: accessModes: - ReadWriteOnce + storageClassName: gp3 resources: requests: storage: 1Gi \ No newline at end of file From 287b48731624b53c75208a3c54b60c0819cc10ff Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 18:31:47 +0100 Subject: [PATCH 12/30] ci-cd modifiedv10 --- k8s/postgres/postgres-pvc.yaml | 4 ++-- k8s/redis/redis-pvc.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/k8s/postgres/postgres-pvc.yaml b/k8s/postgres/postgres-pvc.yaml index 0463d295..77353bd9 100644 --- a/k8s/postgres/postgres-pvc.yaml +++ b/k8s/postgres/postgres-pvc.yaml @@ -5,7 +5,7 @@ metadata: spec: accessModes: - ReadWriteOnce + storageClassName: gp2 resources: requests: - storage: 5Gi # Ajusta a 5Gi si ya existe uno con ese tamaño (como en tu error anterior) - storageClassName: gp3 # O el StorageClass de tu cluster EKS (gp2 es común en AWS) \ No newline at end of file + storage: 5Gi \ No newline at end of file diff --git a/k8s/redis/redis-pvc.yaml b/k8s/redis/redis-pvc.yaml index 708e9d56..c590442b 100644 --- a/k8s/redis/redis-pvc.yaml +++ b/k8s/redis/redis-pvc.yaml @@ -5,7 +5,7 @@ metadata: spec: accessModes: - ReadWriteOnce - storageClassName: gp3 + storageClassName: gp2 resources: requests: storage: 1Gi \ No newline at end of file From bb4e6160b824cb40d2723f710ec608b337255fc1 Mon Sep 17 00:00:00 2001 From: gerardo_gm Date: Fri, 20 Feb 2026 18:39:40 +0100 Subject: [PATCH 13/30] fix: resolve PVC conflict, set storageClassName to gp2 --- ironhack-project-2-latin-team.sln | 24 ++++++++++++++++++++++++ k8s/postgres/postgres-pvc.yaml | 3 ++- k8s/redis/redis-pvc.yaml | 3 ++- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 ironhack-project-2-latin-team.sln diff --git a/ironhack-project-2-latin-team.sln b/ironhack-project-2-latin-team.sln new file mode 100644 index 00000000..e85edc8e --- /dev/null +++ b/ironhack-project-2-latin-team.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.2.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Worker", "worker\Worker.csproj", "{69C79C25-F84F-479E-3E79-EC68C71F7F70}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {69C79C25-F84F-479E-3E79-EC68C71F7F70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69C79C25-F84F-479E-3E79-EC68C71F7F70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69C79C25-F84F-479E-3E79-EC68C71F7F70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69C79C25-F84F-479E-3E79-EC68C71F7F70}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ACB31A12-1815-4DB8-BAB2-C86F254A0117} + EndGlobalSection +EndGlobal diff --git a/k8s/postgres/postgres-pvc.yaml b/k8s/postgres/postgres-pvc.yaml index 77353bd9..85879b6d 100644 --- a/k8s/postgres/postgres-pvc.yaml +++ b/k8s/postgres/postgres-pvc.yaml @@ -8,4 +8,5 @@ spec: storageClassName: gp2 resources: requests: - storage: 5Gi \ No newline at end of file + storage: 5Gi # Ajusta a 5Gi si ya existe uno con ese tamaño (como en tu error anterior) + storageClassName: gp2 # O el StorageClass de tu cluster EKS (gp2 es común en AWS) diff --git a/k8s/redis/redis-pvc.yaml b/k8s/redis/redis-pvc.yaml index c590442b..6f6ec9ac 100644 --- a/k8s/redis/redis-pvc.yaml +++ b/k8s/redis/redis-pvc.yaml @@ -8,4 +8,5 @@ spec: storageClassName: gp2 resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi + storageClassName: gp2 \ No newline at end of file From 84d1ed02843cadb30262bf3418d17af4105982bc Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 18:43:38 +0100 Subject: [PATCH 14/30] ci-cd modifiedv11 --- k8s/postgres/postgres-deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/postgres/postgres-deployment.yaml b/k8s/postgres/postgres-deployment.yaml index 25a7b3e5..e2525f13 100644 --- a/k8s/postgres/postgres-deployment.yaml +++ b/k8s/postgres/postgres-deployment.yaml @@ -45,7 +45,7 @@ spec: resources: requests: storage: 5Gi # ← Cambia a 5Gi (o el tamaño final que necesitas) - storageClassName: ebs-gp3 + storageClassName: gp2 --- apiVersion: v1 From 8c34e37f9e9f6dcc0480763a69d45801556b8bde Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 18:57:24 +0100 Subject: [PATCH 15/30] ci-cd modifiedv13 --- k8s/postgres/postgres-deployment.yaml | 30 +-------------------------- k8s/redis/redis-deployment.yaml | 30 +-------------------------- 2 files changed, 2 insertions(+), 58 deletions(-) diff --git a/k8s/postgres/postgres-deployment.yaml b/k8s/postgres/postgres-deployment.yaml index e2525f13..7a7fe05a 100644 --- a/k8s/postgres/postgres-deployment.yaml +++ b/k8s/postgres/postgres-deployment.yaml @@ -31,32 +31,4 @@ spec: volumes: - name: postgres-data persistentVolumeClaim: - claimName: postgres-pvc - ---- - -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: postgres-pvc -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 5Gi # ← Cambia a 5Gi (o el tamaño final que necesitas) - storageClassName: gp2 ---- - -apiVersion: v1 -kind: Service -metadata: - name: postgres-service -spec: - selector: - app: postgres - ports: - - protocol: TCP - port: 5432 - targetPort: 5432 - type: ClusterIP \ No newline at end of file + claimName: postgres-pvc \ No newline at end of file diff --git a/k8s/redis/redis-deployment.yaml b/k8s/redis/redis-deployment.yaml index 10261788..77648f09 100644 --- a/k8s/redis/redis-deployment.yaml +++ b/k8s/redis/redis-deployment.yaml @@ -23,32 +23,4 @@ spec: volumes: - name: redis-data persistentVolumeClaim: - claimName: redis-pvc - ---- - -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: redis-pvc -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi - ---- - -apiVersion: v1 -kind: Service -metadata: - name: redis-service -spec: - selector: - app: redis - ports: - - protocol: TCP - port: 6379 - targetPort: 6379 - type: ClusterIP \ No newline at end of file + claimName: redis-pvc \ No newline at end of file From f9dfc8b9f0279714a2199ca08be0fe62fd9f29bf Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 19:04:05 +0100 Subject: [PATCH 16/30] ci-cd modifiedv14 --- .github/workflows/ci-cd-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index 6f71b44b..67f9a0d2 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -41,7 +41,7 @@ jobs: docker push ${{ secrets.DOCKER_USERNAME }}/worker:latest - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::686699774218:role/github-actions-eks-role aws-region: ${{ secrets.AWS_REGION }} From 7db5f4a75026202ad9c84d018aff9ee87a4225a7 Mon Sep 17 00:00:00 2001 From: gerardo_gm Date: Fri, 20 Feb 2026 19:16:55 +0100 Subject: [PATCH 17/30] fix: add subPath to postgres volume mount --- k8s/postgres/postgres-deployment.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/k8s/postgres/postgres-deployment.yaml b/k8s/postgres/postgres-deployment.yaml index 7a7fe05a..9ef2ad9a 100644 --- a/k8s/postgres/postgres-deployment.yaml +++ b/k8s/postgres/postgres-deployment.yaml @@ -27,6 +27,7 @@ spec: value: votes volumeMounts: - mountPath: /var/lib/postgresql/data + subPath: pgdata name: postgres-data volumes: - name: postgres-data From bf7419c3af5bf8d25e189a708bab647c2f10beab Mon Sep 17 00:00:00 2001 From: gerardo_gm Date: Fri, 20 Feb 2026 19:23:43 +0100 Subject: [PATCH 18/30] fix: add subPath to postgres, fix PVCs storageClassName --- k8s/redis/redis-pvc.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/k8s/redis/redis-pvc.yaml b/k8s/redis/redis-pvc.yaml index 6f6ec9ac..c590442b 100644 --- a/k8s/redis/redis-pvc.yaml +++ b/k8s/redis/redis-pvc.yaml @@ -8,5 +8,4 @@ spec: storageClassName: gp2 resources: requests: - storage: 1Gi - storageClassName: gp2 \ No newline at end of file + storage: 1Gi \ No newline at end of file From 9769f4b42c9a3ff8ebfde6a697c9ac056a17409f Mon Sep 17 00:00:00 2001 From: gerardo_gm Date: Fri, 20 Feb 2026 19:58:37 +0100 Subject: [PATCH 19/30] Delete example host from ingress.yaml --- k8s/ingress/ingress.yaml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml index 38affbaf..3c5f903a 100644 --- a/k8s/ingress/ingress.yaml +++ b/k8s/ingress/ingress.yaml @@ -3,16 +3,11 @@ kind: Ingress metadata: name: voting-ingress annotations: - cert-manager.io/cluster-issuer: "letsencrypt-prod" + nginx.ingress.kubernetes.io/ssl-redirect: "false" spec: ingressClassName: nginx - tls: - - hosts: - - example.com - secretName: voting-tls rules: - - host: example.com - http: + - http: paths: - path: /vote pathType: Prefix From 72003ec31188c8fc08d7d34c88d8aef9a209a04f Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 20:03:40 +0100 Subject: [PATCH 20/30] ci-cd modifiedv15 --- k8s/ingress/ingress.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml index 3c5f903a..072b3f54 100644 --- a/k8s/ingress/ingress.yaml +++ b/k8s/ingress/ingress.yaml @@ -9,14 +9,14 @@ spec: rules: - http: paths: - - path: /vote + - path: /vote(/|$)(.*) pathType: Prefix backend: service: name: vote-service port: number: 80 - - path: /result + - path: /result(/|$)(.*) pathType: Prefix backend: service: From d7487976e84896ce28acf5da0340f228ae5a3ba7 Mon Sep 17 00:00:00 2001 From: CESAR Date: Fri, 20 Feb 2026 20:07:43 +0100 Subject: [PATCH 21/30] ci-cd modifiedv16 --- k8s/ingress/ingress.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml index 072b3f54..4f996423 100644 --- a/k8s/ingress/ingress.yaml +++ b/k8s/ingress/ingress.yaml @@ -10,14 +10,14 @@ spec: - http: paths: - path: /vote(/|$)(.*) - pathType: Prefix + pathType: ImplementationSpecific backend: service: name: vote-service port: number: 80 - path: /result(/|$)(.*) - pathType: Prefix + pathType: ImplementationSpecific backend: service: name: result-service From b00c163f7938dd8d7b75f38ebccc2ec1f93cefe8 Mon Sep 17 00:00:00 2001 From: gerardo_gm Date: Fri, 20 Feb 2026 20:35:44 +0100 Subject: [PATCH 22/30] css style correction in vote --- k8s/ingress/ingress.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml index 4f996423..99703d69 100644 --- a/k8s/ingress/ingress.yaml +++ b/k8s/ingress/ingress.yaml @@ -9,15 +9,15 @@ spec: rules: - http: paths: - - path: /vote(/|$)(.*) - pathType: ImplementationSpecific + - path: / + pathType: Prefix backend: service: name: vote-service port: number: 80 - - path: /result(/|$)(.*) - pathType: ImplementationSpecific + - path: /result + pathType: Prefix backend: service: name: result-service From 2233627fe4b070ed3634174250889b0ff56f1698 Mon Sep 17 00:00:00 2001 From: gerardo_gm Date: Mon, 23 Feb 2026 09:59:41 +0100 Subject: [PATCH 23/30] add security context to redis in redis-deployment.yml --- k8s/redis/redis-deployment.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/k8s/redis/redis-deployment.yaml b/k8s/redis/redis-deployment.yaml index 77648f09..6ff4f36f 100644 --- a/k8s/redis/redis-deployment.yaml +++ b/k8s/redis/redis-deployment.yaml @@ -15,6 +15,9 @@ spec: containers: - name: redis image: redis:alpine + securityContext: + runAsUser: 999 + runAsGroup: 999 ports: - containerPort: 6379 volumeMounts: From 29312d9845c9ec8f1603e2dc7796ba2f56056b0c Mon Sep 17 00:00:00 2001 From: CESAR Date: Mon, 23 Feb 2026 11:14:17 +0100 Subject: [PATCH 24/30] db credentials update --- k8s/postgres/postgres-deployment.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/k8s/postgres/postgres-deployment.yaml b/k8s/postgres/postgres-deployment.yaml index 9ef2ad9a..e4a9d605 100644 --- a/k8s/postgres/postgres-deployment.yaml +++ b/k8s/postgres/postgres-deployment.yaml @@ -18,6 +18,11 @@ spec: ports: - containerPort: 5432 env: + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: db-credentials + key: POSTGRES_USER - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: From 2709c74d2e5ff025960fe57e00bf37aff8aca6d2 Mon Sep 17 00:00:00 2001 From: gerardo_gm Date: Mon, 23 Feb 2026 11:55:09 +0100 Subject: [PATCH 25/30] add user fsGroup:999 to the pods --- k8s/redis/redis-deployment.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/k8s/redis/redis-deployment.yaml b/k8s/redis/redis-deployment.yaml index 6ff4f36f..4118e4c3 100644 --- a/k8s/redis/redis-deployment.yaml +++ b/k8s/redis/redis-deployment.yaml @@ -12,6 +12,8 @@ spec: labels: app: redis spec: + securityContext: + fsGroup: 999 containers: - name: redis image: redis:alpine From 42a842d1da4228b851f03dcab781441da5aabbe4 Mon Sep 17 00:00:00 2001 From: CESAR Date: Mon, 23 Feb 2026 12:43:23 +0100 Subject: [PATCH 26/30] adding clusterissuer --- k8s/cert-manager/clusterissuer.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 k8s/cert-manager/clusterissuer.yaml diff --git a/k8s/cert-manager/clusterissuer.yaml b/k8s/cert-manager/clusterissuer.yaml new file mode 100644 index 00000000..2ec7e79d --- /dev/null +++ b/k8s/cert-manager/clusterissuer.yaml @@ -0,0 +1,21 @@ +apiVersion: cert-manager.io/v1 +kind: ClusterIssuer +metadata: + name: letsencrypt-prod +spec: + acme: + server: https://acme-v02.api.letsencrypt.org/directory + email: de.gerardogmilian@gmail.com + privateKeySecretRef: + name: letsencrypt-prod + solvers: + - dns01: + route53: + region: sa-east-1 + accessKeyID: AKIAZ7YT7AEFB5WDTS7V + secretAccessKeySecretRef: + name: route53-secret + key: secret-access-key + selector: + dnsZones: + - app-vote-latin.com \ No newline at end of file From d07361f4ab4a727f731be594175edfa923c4b551 Mon Sep 17 00:00:00 2001 From: CESAR Date: Mon, 23 Feb 2026 14:29:24 +0100 Subject: [PATCH 27/30] adding voting tls --- infra/eks/cluster.yaml | 15 +++++++++++++++ k8s/ingress/ingress.yaml | 10 ++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/infra/eks/cluster.yaml b/infra/eks/cluster.yaml index 13daaa7b..1e77d7db 100644 --- a/infra/eks/cluster.yaml +++ b/infra/eks/cluster.yaml @@ -22,6 +22,21 @@ managedNodeGroups: externalDNS: true certManager: true + - name: standard-workers-medium + instanceType: t3.medium + minSize: 1 + maxSize: 3 + desiredCapacity: 2 + volumeSize: 30 + volumeType: gp3 + ssh: + allow: false + iam: + withAddonPolicies: + autoScaler: true + externalDNS: true + certManager: true + addons: - name: vpc-cni - name: coredns diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml index 99703d69..5dcc9edd 100644 --- a/k8s/ingress/ingress.yaml +++ b/k8s/ingress/ingress.yaml @@ -4,12 +4,18 @@ metadata: name: voting-ingress annotations: nginx.ingress.kubernetes.io/ssl-redirect: "false" + cert-manager.io/cluster-issuer: "letsencrypt-prod" spec: ingressClassName: nginx + tls: + - hosts: + - app-vote-latin.com + secretName: voting-tls rules: - - http: + - host: app-vote-latin.com + http: paths: - - path: / + - path: /vote pathType: Prefix backend: service: From 18d4a003409b854610a9ccce5f95aa93e8fa61ca Mon Sep 17 00:00:00 2001 From: CESAR Date: Mon, 23 Feb 2026 16:14:41 +0100 Subject: [PATCH 28/30] changes --- k8s/ingress/ingress.yaml | 3 +-- tls.crt | 19 +++++++++++++++++++ tls.key | 28 ++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 tls.crt create mode 100644 tls.key diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml index 5dcc9edd..84a565db 100644 --- a/k8s/ingress/ingress.yaml +++ b/k8s/ingress/ingress.yaml @@ -3,8 +3,7 @@ kind: Ingress metadata: name: voting-ingress annotations: - nginx.ingress.kubernetes.io/ssl-redirect: "false" - cert-manager.io/cluster-issuer: "letsencrypt-prod" + kubernetes.io/ingress.class: "nginx" spec: ingressClassName: nginx tls: diff --git a/tls.crt b/tls.crt new file mode 100644 index 00000000..5fa0478f --- /dev/null +++ b/tls.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDGzCCAgOgAwIBAgIUAKYbNV6k7tMeiP2nQFqF5ePsuWswDQYJKoZIhvcNAQEL +BQAwHTEbMBkGA1UEAwwSYXBwLXZvdGUtbGF0aW4uY29tMB4XDTI2MDIyMzE1MDYz +MVoXDTI3MDIyMzE1MDYzMVowHTEbMBkGA1UEAwwSYXBwLXZvdGUtbGF0aW4uY29t +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtgBEWVhD3tk2tQoClUEK +tSTXKzn32I+uRaVJxGuvPQ3W8+wna5ElN9dzu5g2OzLI6ewiFiH2t30VpeZAIGUl +xbSFm0vtZC/73p2AnJr8EUT7YLf+kX06BADXU73JMox1EJrSMLLfumT9mfQD4qw/ +TGYTuzfRoD+FDYMr/uGVcehccUJpGeVqMvyYw91IkpHPQxcHMUmARNtE/ubKWTf1 +7HatkBauqrTarsM+LJnt1QSCyUvacjZvmPWYFncshDwu6RhQ1Jf7IsIXzGBzjNyU +hZhuaGGhQSJTOiJflhcMJyfFNe1HUrfd7nga3gFSr0c0CPMA88+5ps2+m0dTud8B +VQIDAQABo1MwUTAdBgNVHQ4EFgQUvUKefVJ4YJm5FtHwzOFRKt6eZ3kwHwYDVR0j +BBgwFoAUvUKefVJ4YJm5FtHwzOFRKt6eZ3kwDwYDVR0TAQH/BAUwAwEB/zANBgkq +hkiG9w0BAQsFAAOCAQEAHQWlIT2qY9T7DE+qX7toUHM+srYhTkBuWmP23eT22DZQ +/GxY3VOZaiQO6BeChhyvatBRBIqIuf/DpVtR8SUdhVprzxAAIaZwzE0LspFUzCnb +f45vX76a2kXd2qgC9G5t4HYIbngYdQiUeizttw9+6OGD3ptuV/jOCI6MsJmKBOqC +Z9MW0oTFzJyUsGgoNq5og/T1DVHEoqq4vIXpHX4zCnEhsT1dfvBny6jZseDMuHWz +2GOe6obSpIB2JS6pThQJgVxcZ4ou1U5FTY+izhhOb9ONwp2AMUjKvLhNQ0fLTkit +BPs2AzTFDVIJVnw9EWFW8vYuSVMmrZ++ZHkMTLGWXQ== +-----END CERTIFICATE----- diff --git a/tls.key b/tls.key new file mode 100644 index 00000000..d6acce1c --- /dev/null +++ b/tls.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2AERZWEPe2Ta1 +CgKVQQq1JNcrOffYj65FpUnEa689Ddbz7CdrkSU313O7mDY7Msjp7CIWIfa3fRWl +5kAgZSXFtIWbS+1kL/venYCcmvwRRPtgt/6RfToEANdTvckyjHUQmtIwst+6ZP2Z +9APirD9MZhO7N9GgP4UNgyv+4ZVx6FxxQmkZ5Woy/JjD3UiSkc9DFwcxSYBE20T+ +5spZN/Xsdq2QFq6qtNquwz4sme3VBILJS9pyNm+Y9ZgWdyyEPC7pGFDUl/siwhfM +YHOM3JSFmG5oYaFBIlM6Il+WFwwnJ8U17UdSt93ueBreAVKvRzQI8wDzz7mmzb6b +R1O53wFVAgMBAAECggEAVMhcDqjU+R+D4iMXH/NMKyVNzNe0st//5XbBnewyFoV3 +cGq+1FepmFFYGvglrz8RpBL5sAjDVyfAaWeQ0OZ9iZN2N+lPXYAS21nQu2NhcCQL +3DrqLllBKPNBW8PJ0a/nqsQMjV4OZdS85LZtBu+JjyvwHiM7FmTwtOI5oQLyLLyx +TjZxJSKs2CQykltEUXBRBWh+dAF7dj2lEOZowuJ4BijKRC8ZDX8GyPrPZhwFZcdB +QPkEGAUJTTcfhDJuJS4WZ1T/to8qUL1zGYki6JKYK5tiN03jKIngXJ88iXINzCX/ +Jsg1YTG/Xe68noiDbgT95VnXw8itxrWWFJK+YYkNAwKBgQDroozGi1OfS01kSXE9 +aUmdzojQH5BWxxlGnC/gNxuudiZTJ96TLz4OFgvmOyP7/auAyhRvc6zbSDCzjZFR +5oSp+EaOg5XU9bxeZ4Vi/myWdtjvYxF0y+f1hfWxC6haACiXA8r0vZrtFGWE0y0B +aRLPlI+bTCczGVWVb2d2pJNXqwKBgQDFuw+DrWIGlcA/E6pUENiUn17zzVZWRoKY +BGAjOw8gpTgC2ydjoySNsrfiqZUTPvBVW5mAKJfMVfbmoN86CCd1Zi98WDQ7SFTH +O+zIiYcgITU4JooIY5flmLUijfMEw087koIDv6Ngzp4L26+YHyNXbvxx+M7N27Sn +hS4C1woK/wKBgQDp2u8/9PLO+xsZ1tGuExpepaWeeFT16q8pJsVVDxxH7zZl/QGm +rZI2xKaWnkc+Rim5rdTOL81z65d5+5wn3lH3plHQCsPfEOsb/j2hW8RFKDpwiq++ +bMgPIh4O0fUJLXMbPUZl0u85L675PeRCrBdhMJ29kLyuuAv6PRA/7WHV9QKBgDa2 +Oea/lP4pdZZ+hITaXHNTXdysFpWs0PnrTAazks3/qW3w4gdJ3xVuPD91mRBIPAwC +WokBsm8R4k2SefH+y5xKeB058snsi7jNNgmPNFqJlcZBs7P6is823/f9ux64RDZB +pcQPxM9GnKi/UukOxKKuzR9kLyT7BBPOYBrdEaRVAoGBAIHKctvTb+UrJg0cEyVN +M8Qa5Jf+mWJPHZYoYAdmBwr/5kj+slPUekzJ26Ylb5PH1zxPoh8Dm9P1Y+XGPyTg ++wPXa0W1W9UdMkGxGqfbvdw1UvAZOyz1Kw1zzmsRR3NrGLqMUpIDEx/g5rePLpgI +gkqo0rOBajFYDFoSHdUiQ9d+ +-----END PRIVATE KEY----- From bdc0c1849c41deba6e8d7b43fd06de50636ba52c Mon Sep 17 00:00:00 2001 From: CESAR Date: Mon, 23 Feb 2026 17:03:36 +0100 Subject: [PATCH 29/30] changes --- k8s/ingress/ingress.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml index 84a565db..4048a1ea 100644 --- a/k8s/ingress/ingress.yaml +++ b/k8s/ingress/ingress.yaml @@ -9,7 +9,7 @@ spec: tls: - hosts: - app-vote-latin.com - secretName: voting-tls + secretName: voting-tls-selfsigned rules: - host: app-vote-latin.com http: From d37f5547dccc2d60fa9d3f83a934ec1fd189bc58 Mon Sep 17 00:00:00 2001 From: CESAR Date: Mon, 23 Feb 2026 18:16:34 +0100 Subject: [PATCH 30/30] last change --- k8s/cert-manager/clusterissuer.yaml | 3 ++- k8s/ingress/ingress.yaml | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/k8s/cert-manager/clusterissuer.yaml b/k8s/cert-manager/clusterissuer.yaml index 2ec7e79d..5590560b 100644 --- a/k8s/cert-manager/clusterissuer.yaml +++ b/k8s/cert-manager/clusterissuer.yaml @@ -8,6 +8,7 @@ spec: email: de.gerardogmilian@gmail.com privateKeySecretRef: name: letsencrypt-prod + preferredChain: "ISRG Root X1" solvers: - dns01: route53: @@ -18,4 +19,4 @@ spec: key: secret-access-key selector: dnsZones: - - app-vote-latin.com \ No newline at end of file + - "app-vote-latin.com" \ No newline at end of file diff --git a/k8s/ingress/ingress.yaml b/k8s/ingress/ingress.yaml index 4048a1ea..4778dd8e 100644 --- a/k8s/ingress/ingress.yaml +++ b/k8s/ingress/ingress.yaml @@ -4,6 +4,7 @@ metadata: name: voting-ingress annotations: kubernetes.io/ingress.class: "nginx" + cert-manager.io/cluster-issuer: "letsencrypt-prod" spec: ingressClassName: nginx tls: @@ -14,7 +15,7 @@ spec: - host: app-vote-latin.com http: paths: - - path: /vote + - path: / pathType: Prefix backend: service: @@ -27,4 +28,20 @@ spec: service: name: result-service port: - number: 80 \ No newline at end of file + number: 80 + - http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: vote-service + port: + number: 80 + - path: /result + pathType: Prefix + backend: + service: + name: result-service + port: + number: 80 \ No newline at end of file