Getting 403 error on cluster URL on spring-boot app deployed in AWS

Viewed 24

System Details

Cloud : AWS

Java version : JDK 1.8

Gradle Build

Docker container

Container Repository : ECR

This is my Cluster information enter image description here Cluster API End point : https://0988CED806736774EB5AB13DAF31BAD0.gr7.us-east-1.eks.amazonaws.com

This is my ec2 instance generated from Terraform enter image description here

This is how I am accessing on my local enter image description here

This is my k8s status of deployment enter image description here

And finally when I am trying to access API end points getting 403 error enter image description here

Need to know what messed up here, I havent attached Terraform file, let me know if this is required to share for more information.

Below is my deployment.yaml file

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: sb-getting-started
  name: sb-getting-started
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sb-getting-started
  template: 
    metadata:
      labels:
        app: sb-getting-started
    spec:
      containers:
        - name: sb-getting-started
          env:
            - name: SPRING_PROFILES_ACTIVE
              value: dev
          image: 765982765312.dkr.ecr.us-east-1.amazonaws.com/my-demo-ecr-repo:latest
          imagePullPolicy: Always
          securityContext:
            runAsUser: 1000
          ports:
          - name: container-port
            containerPort: 8080
          readinessProbe:
            tcpSocket:
              port: 8080
            initialDelaySeconds: 15
            periodSeconds: 10
          livenessProbe:
            tcpSocket:
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 30

networks.yaml

---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-all
spec:
  podSelector: {}
  ingress:
  - {}
  policyTypes:
  - Ingress

services.yaml

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: sb-getting-started
  name: sb-getting-started
spec:
  ports:
  - name: sb-getting-started
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: sb-getting-started
  type: ClusterIP

0 Answers
Related