I am trying to my spring boot micro service in GKE Cluster with istio 1.1.5 latest version as of now. It throws error and pod never spins up. If I run it as a separate service in Kubernetes engine it works perfectly but with isito, it does not work. The purpose for using istio is to host multiple microservices and to use the feature istio provides. Here is my yaml file:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: revenue  
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: revenue-serv
        tier: backend
        track: stable
    spec:
      containers:
        - name: backend
          image: "gcr.io/finacials/revenue-serv:latest"
          imagePullPolicy: Always
          ports:
          - containerPort: 8081
          livenessProbe:
              httpGet:
                path: /
                port: 8081
              initialDelaySeconds: 15
              timeoutSeconds: 30 
          readinessProbe:
              httpGet:
                path: /
                port: 8081
              initialDelaySeconds: 15
              timeoutSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: revenue-serv
spec:
  ports:
    - port: 8081
      #targetPort: 8081
      #protocol: TCP
      name: http 
  selector:
    app: revenue-serv
    tier: backend
  type: LoadBalancer
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: gateway
  annotations:
    kubernetes.io/ingress.class: "istio"
spec:
  rules:
  - http:
      paths:
      - path: /revenue/.*
        backend:
          serviceName: revenue-serv
          servicePort: 8081

Thanks for your valuable feedback.

1 Answers

1
ARINDAM BANERJEE On Best Solutions

I have found the issue. I removed readynessProbe and livenessProbe and created ingressgateway and virtual service. It worked.

deployment & service:

#########################################################################################
# This is for deployment - Service & Deployment in Kubernetes            ################
# Author: Arindam Banerjee                                               ################
#########################################################################################

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: revenue-serv
  namespace: dev  
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: revenue-serv
        version: v1
    spec:
      containers:
        - name: revenue-serv
          image: "eu.gcr.io/rcup-mza-dev/revenue-serv:latest"
          imagePullPolicy: Always
          ports:
          - containerPort: 8081
---
apiVersion: v1
kind: Service
metadata:
  name: revenue-serv
  namespace: dev    
spec:
  ports:
    - port: 8081      
      name: http 
  selector:
    app: revenue-serv

gateway.yaml

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: worldcup-serv-gateway
  namespace: dev
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"

virtual-service.yaml

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: revenue-serv-virtualservice
  namespace: dev  
spec:
  hosts:
  - "*"
  gateways:
  - revenue-serv-gateway
  http:
  - route:
    - destination:
        host: revenue-serv