PacktPublishing / Hands-On-Software-Engineering-with-Golang

Hands-On Software Engineering with Golang, published by Packt
MIT License
426 stars 127 forks source link

chapter 10 k8s deployment issue with linksrus-monolith-instance #15

Closed igavrysh closed 2 years ago

igavrysh commented 2 years ago

When I try to deploy 03-linksrus-monolith.yaml from chapter 10 I receive errors linked to apiVersion v1beta1. If I go ahead and update linksrus-ingress with one available below, I receive next message:

[kubectl] data namespace already exists
[kubectl] deploying linksrus
 | namespace/linksrus unchanged
 | namespace/linksrus-data unchanged
 | job.batch/cdb-ensure-schema unchanged
 | service/linksrus-frontend unchanged
 | service/linksrus-headless unchanged
 | statefulset.apps/linksrus-monolith-instance unchanged
 | Error from server (BadRequest): error when creating "03-linksrus-monolith.yaml": admission 
webhook "validate.nginx.ingress.kubernetes.io" denied the request: host "_" and path "/" is 
already defined in ingress linksrus/linksrus-ingress
make: *** [Makefile:58: deploy] Error 1

It is something that is unclear to me as I explicitly set port to 80 in linksrus-ingress & 8080 in linksrus-monolith-instance. Why it would complain about paths or hosts overlap

My update for linksrus-ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: linksrus-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
#  namespace: linksrus
spec:
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: linksrus-frontend
                port:
                  number: 80
---

Original 03-linksrus-monolith.yaml file is available here: yaml file in my github repo