кластере извне по локалхосту?
Есть вот такой сервис
apiVersion: v1
kind: Service
metadata:
name: comment-api-public
labels:
app: comment-api-public
service: comment-api-public
spec:
type: NodePort
ports:
- name: http
port: 5005
targetPort: 5000
selector:
app: comment-api-public
И вот такой ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- http:
paths:
- path: /private-api-comment
pathType: Prefix
backend:
service:
name: comment-api-private
port:
number: 5005
- path: /public-api-comment
pathType: Prefix
backend:
service:
name: comment-api-public
port:
number: 5005
describe ingress выдает вот такое
Name: ingress
Namespace: default
Address: localhost
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
Host Path Backends
---- ---- --------
*
/private-api-comment comment-api-private:5005 (172.17.0.9:5000)
/public-api-comment comment-api-public:5005 (172.17.0.7:5000)
Annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Sync 7h19m (x12 over 8h) nginx-ingress-controller Scheduled for sync
https://stackoverflow.com/questions/70011639/ingress-not-forwarding-the-requests-docker-desktop-for-windows-and-kubernetes
Cперва проверьте работает ли сам service изменив type: LoadBalancer Если service ok, потом <error: endpoints "default-http-backend" not found> напишите backend для ingress https://kubernetes.io/docs/concepts/services-networking/ingress/
Обсуждают сегодня