<p>I'm using eureka-client, eureka-server, spring-cloud-starter-gateway and kafka to build my api. Using microservices, it works like this: the command sends a request to kafka for it to run, the Kafka that is installed on my machine and is not in a container. Command example:</p>
<pre><code>@Autowired
private KafkaTemplate&lt;String, ContactAdmSaveDto&gt; kafkaTemplate;

@Override
public String create(ContactAdmSaveDto data) {
    kafkaTemplate.send(&quot;contact-adm-insert&quot;, data);
    return &quot;Cadastrado com sucesso!&quot;;
}
</code></pre>
<p>application.properties command producer:</p>
<pre><code>spring.kafka.producer.bootstrap-servers=springboot:9092
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer


server.port = 30006
spring.application.name = contact-adm-command
eureka.client.serviceUrl.defaultZone = http://springboot:30002/eureka
eureka.instance.hostname=springboot
eureka.instance.prefer-ip-address=true
</code></pre>
<p>Example from Kafka:</p>
<pre><code>@KafkaListener(topics = {&quot;contact-adm-insert&quot;}, groupId = &quot;contact-adm&quot;)
public void consume(String record){

    try {
        
        ObjectMapper mapper = new ObjectMapper();
        ContactAdm data = mapper.readValue(record, ContactAdm.class);
        
        ContactAdm cat = new ContactAdm();
        cat.setCell_phone(data.getCell_phone());
        cat.setEmail(data.getEmail());
        cat.setTelephone(data.getTelephone());
       
        ContactAdm c = contactAdmRepository.save(cat);

        ContactAdmMongo catm = new ContactAdmMongo();
        catm.setCell_phone(data.getCell_phone());
        catm.setEmail(data.getEmail());
        catm.setTelephone(data.getTelephone());
        catm.setContact_id(c.getContact_id());

        contactAdmRepositoryMongo.save(catm);
    } catch (Exception e) {
        logger.info(e.toString());
    }

}
</code></pre>
<p>application.properties kafka consumer:</p>
<pre><code>server.port = 30005
spring.kafka.consumer.bootstrap-servers=springboot:9092
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.group-id=contact-adm
</code></pre>
<p><code>springboot</code> is a host name for my machine's ip</p>
<p>follow my gateway. Remembering that all kafka services are not registered in the gateway they are only to run when they are called by the command:</p>
<pre><code>server.port=30000
spring.application.name=routing
eureka.client.serviceUrl.defaultZone=http://springboot:30002/eureka/
eureka.instance.hostname=springboot
eureka.instance.prefer-ip-address=true


#spring.cloud.gateway.discovery.locator.enabled=true

#spring.main.web-application-type=reactive
spring.cloud.gateway.enabled=true
spring.cloud.gateway.routes[0].id=user
spring.cloud.gateway.routes[0].uri=lb://USER
spring.cloud.gateway.routes[0].predicates=Path=/user/**

spring.cloud.gateway.routes[1].id=testes
spring.cloud.gateway.routes[1].uri=lb://TESTES
spring.cloud.gateway.routes[1].predicates=Path=/testes/**

spring.cloud.gateway.routes[2].id=user-command
spring.cloud.gateway.routes[2].uri=lb://USER-COMMAND
spring.cloud.gateway.routes[2].predicates=Path=/user-command/**

spring.cloud.gateway.routes[3].id=category-product-command
spring.cloud.gateway.routes[3].uri=lb://CATEGORY-PRODUCT-COMMAND
spring.cloud.gateway.routes[3].predicates=Path=/category-product-command/**

spring.cloud.gateway.routes[4].id=category-product-query
spring.cloud.gateway.routes[4].uri=lb://CATEGORY-PRODUCT-QUERY
spring.cloud.gateway.routes[4].predicates=Path=/category-product-query/**

spring.cloud.gateway.routes[5].id=cart-purchase-command
spring.cloud.gateway.routes[5].uri=lb://CART-PURCHASE-COMMAND
spring.cloud.gateway.routes[5].predicates=Path=/cart-purchase-command/**

spring.cloud.gateway.routes[6].id=cart-purchase-query
spring.cloud.gateway.routes[6].uri=lb://CART-PURCHASE-QUERY
spring.cloud.gateway.routes[6].predicates=Path=/cart-purchase-query/**

spring.cloud.gateway.routes[7].id=contact-adm-command
spring.cloud.gateway.routes[7].uri=lb://CONTACT-ADM-COMMAND
spring.cloud.gateway.routes[7].predicates=Path=/contact-adm-command/**

spring.cloud.gateway.routes[8].id=contact-adm-query
spring.cloud.gateway.routes[8].uri=lb://CONTACT-ADM-QUERY
spring.cloud.gateway.routes[8].predicates=Path=/contact-adm-query/**
</code></pre>
<p>This all works fine but I want to put it on kubernetes so I created the services images with the following command: <code>mvn spring-boot:build-image</code> and with the DockerFile:</p>
<pre><code>FROM openjdk:17-alpine
EXPOSE 30000
ADD src/main/resources/routing/public.pem src/main/resources/routing/public.pem
ADD /target/routes-0.0.1-SNAPSHOT.jar routes-0.0.1-SNAPSHOT.jar
ENTRYPOINT [&quot;java&quot;,&quot;-jar&quot;,&quot;routes-0.0.1-SNAPSHOT.jar&quot;]
</code></pre>
<p>Generating all services images and placing them in the docker hub to be pulled by docker kubernetes with the following deployment:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: cart-purchase-kafka
  labels:
    app: cart-purchase-kafka
spec:
  replicas: 1
  # strategy:
  #   rollingUpdate:
  #     maxUnavailable: 0
  #     maxSurge: 1
  selector:
    matchLabels:
      run: cart-purchase-kafka
  template:
    metadata:
      labels:
        run: cart-purchase-kafka
    spec:
      containers:
      - name: cart-purchase-kafka
        image: rafaelribeirosouza86/shopping:cart-purchase-kafka
        imagePullPolicy: Always
        ports:
        - containerPort: 30011
          protocol: TCP
      imagePullSecrets:
        - name: regcred


---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cart-purchase-command
  labels:
    app: cart-purchase-command
spec:
  replicas: 1
  # strategy:
  #   rollingUpdate:
  #     maxUnavailable: 0
  #     maxSurge: 1
  selector:
    matchLabels:
      run: cart-purchase-command
  template:
    metadata:
      labels:
        run: cart-purchase-command
    spec:
      containers:
      - name: cart-purchase-command
        image: rafaelribeirosouza86/shopping:cart-purchase-command
        imagePullPolicy: Always
        ports:
        - containerPort: 30012
          protocol: TCP
      imagePullSecrets:
        - name: regcred

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cart-purchase-query
  labels:
    app: cart-purchase-query
spec:
  replicas: 1
  # strategy:
  #   rollingUpdate:
  #     maxUnavailable: 0
  #     maxSurge: 1
  selector:
    matchLabels:
      run: cart-purchase-query
  template:
    metadata:
      labels:
        run: cart-purchase-query
    spec:
      containers:
      - name: cart-purchase-query
        image: rafaelribeirosouza86/shopping:cart-purchase-query
        imagePullPolicy: Always
        ports:
        - containerPort: 30010
          protocol: TCP
      imagePullSecrets:
        - name: regcred


---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: user
  labels:
    app: user
spec:
  replicas: 1
  # strategy:
  #   rollingUpdate:
  #     maxUnavailable: 0
  #     maxSurge: 1
  selector:
    matchLabels:
      run: user
  template:
    metadata:
      labels:
        run: user
    spec:
      containers:
      - name: user
        image: rafaelribeirosouza86/shopping:user
        imagePullPolicy: Always
        ports:
        - containerPort: 30015
          protocol: TCP
      imagePullSecrets:
        - name: regcred


---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: user-command
  labels:
    app: user-command
spec:
  replicas: 1
  # strategy:
  #   rollingUpdate:
  #     maxUnavailable: 0
  #     maxSurge: 1
  selector:
    matchLabels:
      run: user-command
  template:
    metadata:
      labels:
        run: user-command
    spec:
      containers:
      - name: user-command
        image: rafaelribeirosouza86/shopping:user-command
        imagePullPolicy: Always
        ports:
        - containerPort: 30004
          protocol: TCP
      imagePullSecrets:
        - name: regcred

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: user-command-insert
  labels:
    app: user-command-insert
spec:
  replicas: 1
  # strategy:
  #   rollingUpdate:
  #     maxUnavailable: 0
  #     maxSurge: 1
  selector:
    matchLabels:
      run: user-command-insert
  template:
    metadata:
      labels:
        run: user-command-insert
    spec:
      containers:
      - name: user-command-insert
        image: rafaelribeirosouza86/shopping:user-command-insert
        imagePullPolicy: Always
        ports:
        - containerPort: 30003
          protocol: TCP
      imagePullSecrets:
        - name: regcred
</code></pre>
<p>The big problem so far is that when I run it without Kubernetes it works fine but when I generate the pods it gives errors like:</p>
<pre><code>NAME                                        READY   STATUS                   RESTARTS      AGE
category-product-command-565f758d5d-4wwnf   0/1     Evicted                  0             10m
category-product-command-565f758d5d-54pd5   0/1     Error                    0             29m
category-product-command-565f758d5d-hmb8k   0/1     Pending                  0             2m47s
category-product-command-565f758d5d-k6gmf   0/1     Evicted                  0             10m
category-product-command-565f758d5d-lkd25   0/1     Error                    0             41m
category-product-command-565f758d5d-ltbnl   0/1     Evicted                  0             10m
category-product-command-565f758d5d-m7wwx   0/1     ContainerStatusUnknown   1             35m
category-product-command-565f758d5d-p42td   0/1     Error                    0             54m
category-product-command-565f758d5d-pmfmh   0/1     Error                    0             10m
category-product-command-565f758d5d-qbthd   0/1     Evicted                  0             10m
category-product-command-565f758d5d-qf969   0/1     Evicted                  0             10m
category-product-command-565f758d5d-twjvq   0/1     Evicted                  0             10m
category-product-command-565f758d5d-vfrwq   0/1     ContainerStatusUnknown   1             22m
category-product-command-565f758d5d-xftpq   0/1     Error                    0             47m
category-product-command-565f758d5d-xsg47   0/1     Evicted                  0             10m
category-product-kafka-67d4fdbf76-262n8     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-2klh8     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-2mgp8     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-2rlmm     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-2z57p     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-424pj     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-4cnp2     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-4v586     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-5d7sg     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-5mndm     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-5rcgg     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-5rlz7     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-69w7h     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-6czbj     0/1     Evicted                  0             36m
category-product-kafka-67d4fdbf76-6rtvb     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-6t4km     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-7pkd7     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-99z2b     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-9lfqq     0/1     Error                    1 (42m ago)   53m
category-product-kafka-67d4fdbf76-9nrm4     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-bzx52     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-d62b5     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-dbhp4     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-dscdk     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-fnjdd     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-gnbnp     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-gsrs8     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-h69px     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-hcljj     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-hmxmk     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-hqngl     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-j2bx2     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-jjpkl     0/1     ContainerStatusUnknown   1             35m
category-product-kafka-67d4fdbf76-jqzlr     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-kbc25     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-khljn     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-kqht4     0/1     Error                    0             54m
category-product-kafka-67d4fdbf76-kqxf5     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-l52p9     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-l8x4p     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-ljhrm     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-m6l8c     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-n49br     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-q4z79     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-qgqch     0/1     ContainerStatusUnknown   1             15m
category-product-kafka-67d4fdbf76-qjrf8     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-qntzw     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-qv7s9     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-rkhq6     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-rl2g6     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-rl7dl     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-sbpw6     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-slww4     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-ssm24     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-txtjw     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-v9976     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-vl9gp     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-vns2z     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-vqcz9     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-vst56     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-w5hpg     1/1     Running                  0             8m53s
category-product-kafka-67d4fdbf76-w8tbb     0/1     Evicted                  0             35m
category-product-kafka-67d4fdbf76-wpkwb     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-wvmtt     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-xp5t6     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-xtqwp     0/1     Evicted                  0             23m
category-product-kafka-67d4fdbf76-z56s4     0/1     Error                    0             23m
category-product-query-58897978b9-7csd7     1/1     Running                  0             54m
contact-adm-command-56bb8f75db-9pvvz        1/1     Running                  0             54m
contact-adm-kafka-858d968996-tgqkn          1/1     Running                  0             54m
contact-adm-query-6b6b7487bb-2mqp6          1/1     Running                  0             54m
gateway-7cbcb7bc4c-48b42                    0/1     Pending                  0             3m35s
gateway-7cbcb7bc4c-672mb                    0/1     Evicted                  0             42m
gateway-7cbcb7bc4c-d9hxn                    0/1     ContainerStatusUnknown   1             42m
gateway-7cbcb7bc4c-g97cs                    0/1     Error                    0             16m
gateway-7cbcb7bc4c-hpntm                    0/1     Evicted                  0             42m
gateway-7cbcb7bc4c-js7nc                    0/1     Evicted                  0             42m
gateway-7cbcb7bc4c-lctsk                    0/1     Error                    0             30m
gateway-7cbcb7bc4c-stwbk                    0/1     Evicted                  0             42m
gateway-7cbcb7bc4c-zl4rb                    0/1     Error                    0             54m
routes-cb9ffbb47-tmmw9                      1/1     Running                  0 
</code></pre>
<p>an error in the container:</p>
<pre><code>Caused by: org.apache.hc.core5.http.NoHttpResponseException: springboot:30002 failed to respond
</code></pre>
<p>Does anyone have any idea what the problem might be?</p>

Rafael Souza
<p>[SOLVED]</p>
<p>I made it work with StatefulSet see how my deployments look:</p>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: gateway
spec:
  serviceName: &quot;gateway&quot;
  podManagementPolicy: &quot;Parallel&quot; 
  replicas: 1
  selector:
    matchLabels:
      app: gateway
  template:
    metadata:
      labels:
        app: gateway    
    spec:
      containers:
      - name: gateway
        #command: [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;, &quot;-jar&quot;,&quot;gateway-0.0.1-SNAPSHOT.jar&quot;]
        image: rafaelribeirosouza86/shopping:gateway
        imagePullPolicy: Always
        ports:
        - containerPort: 30002
      imagePullSecrets:
      - name: regcred

---
 
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: routes
spec:
  serviceName: &quot;routes&quot;
  podManagementPolicy: &quot;Parallel&quot; 
  replicas: 1
  selector:
    matchLabels:
      app: routes
  template:
    metadata:
      labels:
        app: routes    
    spec:
      containers:
      - name: routes
        #command: [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;, &quot;-jar&quot;,&quot;routes-0.0.1-SNAPSHOT.jar&quot;]
        image: rafaelribeirosouza86/shopping:routes
        imagePullPolicy: Always
        ports:
        - containerPort: 30000
      imagePullSecrets:
      - name: regcred

---
 
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: user
spec:
  serviceName: &quot;user&quot;
  podManagementPolicy: &quot;Parallel&quot; 
  replicas: 1
  selector:
    matchLabels:
      app: user
  template:
    metadata:
      labels:
        app: user    
    spec:
      containers:
      - name: user
        #command: [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;, &quot;-jar&quot;,&quot;user-0.0.1-SNAPSHOT.jar&quot;]
        image: rafaelribeirosouza86/shopping:user
        imagePullPolicy: Always
        ports:
        - containerPort: 30015
      imagePullSecrets:
      - name: regcred

---
 
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: user-command
spec:
  serviceName: &quot;user-command&quot;
  podManagementPolicy: &quot;Parallel&quot; 
  replicas: 1
  selector:
    matchLabels:
      app: user-command
  template:
    metadata:
      labels:
        app: user-command    
    spec:
      containers:
      - name: user-command
        #command: [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;, &quot;-jar&quot;,&quot;user-command-0.0.1-SNAPSHOT.jar&quot;]
        image: rafaelribeirosouza86/shopping:user-command
        imagePullPolicy: Always
        ports:
        - containerPort: 30004
      imagePullSecrets:
      - name: regcred


---
 
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: user-command-insert
spec:
  serviceName: &quot;user-command-insert&quot;
  podManagementPolicy: &quot;Parallel&quot; 
  replicas: 1
  selector:
    matchLabels:
      app: user-command-insert
  template:
    metadata:
      labels:
        app: user-command-insert   
    spec:
      containers:
      - name: user-command-insert
        #command: [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;, &quot;-jar&quot;,&quot;user-command-insert-0.0.1-SNAPSHOT.jar&quot;]
        image: rafaelribeirosouza86/shopping:user-command-insert
        imagePullPolicy: Always
        ports:
        - containerPort: 30003
      imagePullSecrets:
      - name: regcred
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: category-product-kafka
spec:
  serviceName: &quot;category-product-kafka&quot;
  podManagementPolicy: &quot;Parallel&quot; 
  replicas: 1
  selector:
    matchLabels:
      app: category-product-kafka
  template:
    metadata:
      labels:
        app: category-product-kafka  
    spec:
      containers:
      - name: category-product-kafka
        #command: [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;, &quot;-jar&quot;,&quot;category-product-kafka-0.0.1-SNAPSHOT.jar&quot;]
        image: rafaelribeirosouza86/shopping:category-product-kafka
        imagePullPolicy: Always
        ports:
        - containerPort: 30008
      imagePullSecrets:
      - name: regcred

---

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: category-product-command
spec:
  serviceName: &quot;category-product-command&quot;
  podManagementPolicy: &quot;Parallel&quot; 
  replicas: 1
  selector:
    matchLabels:
      app: category-product-command
  template:
    metadata:
      labels:
        app: category-product-command 
    spec:
      containers:
      - name: category-product-command
        #command: [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;, &quot;-jar&quot;,&quot;category-product-command-0.0.1-SNAPSHOT.jar&quot;]
        image: rafaelribeirosouza86/shopping:category-product-command
        imagePullPolicy: Always
        ports:
        - containerPort: 31533
      imagePullSecrets:
      - name: regcred

       
---

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: category-product-query
spec:
  serviceName: &quot;category-product-query&quot;
  podManagementPolicy: &quot;Parallel&quot; 
  replicas: 1
  selector:
    matchLabels:
      app: category-product-query
  template:
    metadata:
      labels:
        app: category-product-query
    spec:
      containers:
      - name: category-product-query
        #command: [&quot;java&quot;, &quot;-Djava.security.egd=file:/dev/./urandom&quot;, &quot;-jar&quot;,&quot;category-product-query-0.0.1-SNAPSHOT.jar&quot;]
        image: rafaelribeirosouza86/shopping:category-product-query
        imagePullPolicy: Always
        ports:
        - containerPort: 30007
      imagePullSecrets:
      - name: regcred
</code></pre>
<p>Services:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: gateway-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
  ports:
  - port: 30002
    protocol: TCP
    targetPort: 30002
    nodePort: 30002
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: gateway
  
#  type: LoadBalancer
#status:
#  loadBalancer: {}

---

apiVersion: v1
kind: Service
metadata:
  name:  routes-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30000
    protocol: TCP
    targetPort: 30000
    nodePort: 30000
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: routes
#  type: LoadBalancer
#status:
#  loadBalancer: {}
#  type: ClusterIP
#  type: LoadBalancer 
#  type: NodePort

---

apiVersion: v1
kind: Service
metadata:
  name:  contact-adm-query-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30001
    protocol: TCP
    targetPort: 30001
    nodePort: 30001
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: contact-adm-query
  
#  type: LoadBalancer
#status:
#  loadBalancer: {}    
#  type: ClusterIP
#  type: LoadBalancer 
#  type: NodePort
---

apiVersion: v1
kind: Service
metadata:
  name: contact-adm-kafka-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30005
    protocol: TCP
    targetPort: 30005
    nodePort: 30005
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: contact-adm-kafka

---

apiVersion: v1
kind: Service
metadata:
  name: contact-adm-command-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30006
    protocol: TCP
    targetPort: 30006
    nodePort: 30006
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: contact-adm-command


---

apiVersion: v1
kind: Service
metadata:
  name: category-product-kafka-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30008
    protocol: TCP
    targetPort: 30008
    nodePort: 30008
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: category-product-kafka

---

apiVersion: v1
kind: Service
metadata:
  name: category-product-command-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 31533
    protocol: TCP
    targetPort: 31533
    nodePort: 31533
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: category-product-command

---

apiVersion: v1
kind: Service
metadata:
  name: category-product-query-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30007
    protocol: TCP
    targetPort: 30007
    nodePort: 30007
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: category-product-query



---

apiVersion: v1
kind: Service
metadata:
  name: cart-purchase-kafka-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30011
    protocol: TCP
    targetPort: 30011
    nodePort: 30011
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: cart-purchase-kafka   

---

apiVersion: v1
kind: Service
metadata:
  name: cart-purchase-command-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30012
    protocol: TCP
    targetPort: 30012
    nodePort: 30012
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: cart-purchase-command  

---

apiVersion: v1
kind: Service
metadata:
  name: cart-purchase-query-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30010
    protocol: TCP
    targetPort: 30010
    nodePort: 30010
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: cart-purchase-query 

---

apiVersion: v1
kind: Service
metadata:
  name: user-command-insert-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30003
    protocol: TCP
    targetPort: 30003
    nodePort: 30003
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: user-command-insert

---

apiVersion: v1
kind: Service
metadata:
  name: user-command-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30004
    protocol: TCP
    targetPort: 30004
    nodePort: 30004
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: user-command

---

apiVersion: v1
kind: Service
metadata:
  name: user-service
  namespace: default
spec:
#  clusterIP: 10.99.233.224
#   protocol:  ##The default is TCP
#   port: ##Exposes the service within the cluster. Also, other Pods use this to access the Service
#   targetPort: ##The service sends request while containers accept traffic on this port.
  ports:
  - port: 30015
    protocol: TCP
    targetPort: 30015
    nodePort: 30015
#  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: user
</code></pre>
