Sau khi mình upgrade helm chart cho ingress-nginx thì ôi thôi.
Mấy link ingress-chết ngắt.
Fix valid IngressClass
Rất cảm ơn anh Tây
https://forum.linuxfoundation.org/discussion/859965/exercise-7-nginx-update-requires-change-to-yaml
theo như anh mô tạ có a breaking change
https://github.com/kubernetes/ingress-nginx/releases/tag/controller-v1.0.0
If you miss the ingressclass the controller gives you:
“Ignoring ingress because of error while validating ingress class” ingress=”default/ingress-test” error=”ingress does not contain a valid IngressClass”
So a quick fix is adding the annotation for the ingress class to your ingress.yaml Otherwise the whole ingress part of lab 7 will not work.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-test
namespace: default
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: www.example.com
http:
paths:
- backend:
service:
name: secondapp
port:
number: 80
path: /
pathType: ImplementationSpecific
- host: thirdpage.org
http:
paths:
- backend:
service:
name: thirdpage
port:
number: 80
path: /
pathType: ImplementationSpecific
Tóm lại là bạn cần thêm annotation vào các kind Ingress.
annotations:
kubernetes.io/ingress.class: "nginx"
Update Mon Feb 28th, 2021 – ingressClassName
Nếu cluster k8s của bạn đã có version < 1.19
Bạn có thể sử dụng annotation hoặc spec
with annotation:
annotations:
# use the shared ingress-nginx
kubernetes.io/ingress.class: "nginx"
with ingressClassName
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress-myservicea
spec:
ingressClassName: nginx
rules:
- host: myservicea.foo.org
If the cluster uses Kubernetes version >= 1.19.x
Bạn nên sử dụng ingressClassName: nginx
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-myservicea
spec:
rules:
- host: myservicea.foo.org
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: myservicea
port:
number: 80
ingressClassName: nginx
Reference links:
https://kubernetes.github.io/ingress-nginx/user-guide/basic-usage/
Config Ingress-Nginx is default
controller.ingressClassResource.default: true
khi install jenkins bằng helm chart thì bạn có thể set default ingress cho k8s sẽ sài nginx