Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29404

Ho to configure NGINX in aws

$
0
0

I have set up k8s cluster in AWS ec2 instances with 1 parent and 2 child nodes using kops. Deployed 2 services and running with LoadBalancer service type in browser. Now I installed NGINX but through LB ip not able to hit my service. Its giving 504 GATEWAY_TIME_OUT exception. Googled it lot but no success, Where am I going wrong? here is my sample code...[AWS FREE ACCOUNT]

deployment.yml

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: $APP_NAME
  name: $APP_NAME
  namespace: $NAMESPACE
spec:
  replicas: 1
  selector:
    matchLabels:
      app: $APP_NAME  
  template:
    metadata:
      labels:
        app: $APP_NAME        
    spec:
      imagePullSecrets:
      - name: $IMG_PULL_SECRET   
      containers:
      - image: $IMAGE_REG/$APP_NAME:$IMAGE_TAG
        name: $APP_NAME
        imagePullPolicy: Always  

        ports:
        - containerPort: ${CONTAINER_PORT}
          protocol: TCP
        env:
          - name: spring.cloud.config.uri
            value: 'http://config-server-service'

service.yml

apiVersion: v1
kind: Service
metadata:
  labels:
    app: $APP_NAME
  name: $APP_NAME
  namespace: $NAMESPACE
spec:
  type: $SERVICE_TYPE
  #type: $SERVICE_TYPE
  ports:
  - port: 80
    targetPort: ${CONTAINER_PORT}
    protocol: TCP
  selector:
    app: $APP_NAME

ingress.yml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ${APP_NAME}
  namespace: $NAMESPACE
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/affinity: cookie
    nginx.ingress.kubernetes.io/session-cookie-name: JSESSIONID
    nginx.ingress.kubernetes.io/ssl-passthrough: "false"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    kubernetes.io/ingress.class: "nginx"
    kubernetes.io/ingress.allow-http: "true"
#    kubernetes.io/ingress.global-static-ip-name: "my-gateway"
spec:
  rules:
  - http:
      paths:
        - path: /${APP_NAME}
          backend:
            serviceName: ${APP_NAME}
            servicePort: 80

Viewing all articles
Browse latest Browse all 29404

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>