You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 18
Next »
https://strimzi.io/docs/operators/latest/configuring.html
https://strimzi.io/docs/operators/latest/configuring.html#proc-accessing-kafka-using-ingress-str
https://strimzi.io/blog/2019/04/23/accessing-kafka-part-2/
https://github.com/strimzi/strimzi-kafka-operator/blob/main/documentation/api/io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener.adoc
Current Setup - no Ingress (Kohn):
- External Access via Nodeports
- onap-strimzi-kafka-external-bootstrap (30493)
- onap-strimzi-kafka-0 (30490)
- onap-strimzi-kafka-1 (30491)
- onap-strimzi-kafka-2 (30492)
- TLS termination on Kafka Pods
eyJleHRTcnZJbnRlZ1R5cGUiOiIiLCJnQ2xpZW50SWQiOiIiLCJjcmVhdG9yTmFtZSI6IkFuZHJlYXMgR2Vpc3NsZXIiLCJvdXRwdXRUeXBlIjoiYmxvY2siLCJsYXN0TW9kaWZpZXJOYW1lIjoiQW5kcmVhcyBHZWlzc2xlciIsImxhbmd1YWdlIjoiZW4iLCJkaWFncmFtRGlzcGxheU5hbWUiOiIiLCJzRmlsZUlkIjoiIiwiYXR0SWQiOiIxNTY4NjA3NzMiLCJkaWFncmFtTmFtZSI6ImluZ3JlcyIsImFzcGVjdCI6IiIsImxpbmtzIjoiYXV0byIsImNlb05hbWUiOiJLYWZrYSBBY2Nlc3MgdmlhIEluZ3Jlc3MiLCJ0YnN0eWxlIjoidG9wIiwiY2FuQ29tbWVudCI6ZmFsc2UsImRpYWdyYW1VcmwiOiIiLCJjc3ZGaWxlVXJsIjoiIiwiYm9yZGVyIjp0cnVlLCJtYXhTY2FsZSI6IjEiLCJvd25pbmdQYWdlSWQiOjE1Njg2MDc3MCwiZWRpdGFibGUiOmZhbHNlLCJjZW9JZCI6MTU2ODYwOTA5LCJwYWdlSWQiOiIiLCJsYm94Ijp0cnVlLCJzZXJ2ZXJDb25maWciOnsiZW1haWxwcmV2aWV3IjoiMSJ9LCJvZHJpdmVJZCI6IiIsInJldmlzaW9uIjo1LCJtYWNyb0lkIjoiMzRhY2Q2MGUtZmE5YS00ODc4LThmNDYtMTZhNDdiNjQxODE1IiwicHJldmlld05hbWUiOiJpbmdyZXMucG5nIiwibGljZW5zZVN0YXR1cyI6Ik9LIiwic2VydmljZSI6IiIsImlzVGVtcGxhdGUiOiIiLCJ3aWR0aCI6IjQ4NiIsInNpbXBsZVZpZXdlciI6ZmFsc2UsImxhc3RNb2RpZmllZCI6MTY2OTk5ODA4MDAwMCwiZXhjZWVkUGFnZVdpZHRoIjpmYWxzZSwib0NsaWVudElkIjoiIn0=
External Access to Kafka (DT implementation) in Jakarta/Kohn
- External Access via Ingress (Traefik)
- new TCP "EntryPoints" in Traefik Gateway for bootstrap and brokers
- Update Pod "clienttls" ports (9093) to use "advertizedHost" and "advertizedPort"
- NodePorts not used...
- IngressRouteTCP entry to "internal" bootstrap service
- IngressRouteTCP entries to external broker ports
eyJleHRTcnZJbnRlZ1R5cGUiOiIiLCJnQ2xpZW50SWQiOiIiLCJjcmVhdG9yTmFtZSI6IkFuZHJlYXMgR2Vpc3NsZXIiLCJvdXRwdXRUeXBlIjoiYmxvY2siLCJsYXN0TW9kaWZpZXJOYW1lIjoiQW5kcmVhcyBHZWlzc2xlciIsImxhbmd1YWdlIjoiZW4iLCJkaWFncmFtRGlzcGxheU5hbWUiOiIiLCJzRmlsZUlkIjoiIiwiYXR0SWQiOiIxNTY4NjA4MTkiLCJkaWFncmFtTmFtZSI6IlRyYWZpazJLYWZrYSIsImFzcGVjdCI6IiIsImxpbmtzIjoiYXV0byIsImNlb05hbWUiOiJLYWZrYSBBY2Nlc3MgdmlhIEluZ3Jlc3MiLCJ0YnN0eWxlIjoidG9wIiwiY2FuQ29tbWVudCI6ZmFsc2UsImRpYWdyYW1VcmwiOiIiLCJjc3ZGaWxlVXJsIjoiIiwiYm9yZGVyIjp0cnVlLCJtYXhTY2FsZSI6IjEiLCJvd25pbmdQYWdlSWQiOjE1Njg2MDc3MCwiZWRpdGFibGUiOmZhbHNlLCJjZW9JZCI6MTU2ODYwOTA5LCJwYWdlSWQiOiIiLCJsYm94Ijp0cnVlLCJzZXJ2ZXJDb25maWciOnsiZW1haWxwcmV2aWV3IjoiMSJ9LCJvZHJpdmVJZCI6IiIsInJldmlzaW9uIjozLCJtYWNyb0lkIjoiMWM3MTJiMjctMTM2YS00MmY2LWI1ODctYWY0NDRmNGQxYTMwIiwicHJldmlld05hbWUiOiJUcmFmaWsyS2Fma2EucG5nIiwibGljZW5zZVN0YXR1cyI6Ik9LIiwic2VydmljZSI6IiIsImlzVGVtcGxhdGUiOiIiLCJ3aWR0aCI6Ijg4NyIsInNpbXBsZVZpZXdlciI6ZmFsc2UsImxhc3RNb2RpZmllZCI6MTY3MDIzMTE5NDAwMCwiZXhjZWVkUGFnZVdpZHRoIjpmYWxzZSwib0NsaWVudElkIjoiIn0=
Proposal for London (External Access via Ingress)
- External Access via Ingress (istio-ingress)
- new TLS ports on Ingress Gateway for bootstrap and brokers
- Disable TLS on "external" broker ports
- Disable all Nodeports in Service definitions
Need to check:
https://github.com/istio/istio/issues/20076
eyJleHRTcnZJbnRlZ1R5cGUiOiIiLCJnQ2xpZW50SWQiOiIiLCJjcmVhdG9yTmFtZSI6IkFuZHJlYXMgR2Vpc3NsZXIiLCJvdXRwdXRUeXBlIjoiYmxvY2siLCJsYXN0TW9kaWZpZXJOYW1lIjoiQW5kcmVhcyBHZWlzc2xlciIsImxhbmd1YWdlIjoiZW4iLCJkaWFncmFtRGlzcGxheU5hbWUiOiIiLCJzRmlsZUlkIjoiIiwiYXR0SWQiOiIxNTY4NjA3ODkiLCJkaWFncmFtTmFtZSI6IkluZ3Jlc3MyS2Fma2EiLCJhc3BlY3QiOiIiLCJsaW5rcyI6ImF1dG8iLCJjZW9OYW1lIjoiS2Fma2EgQWNjZXNzIHZpYSBJbmdyZXNzIiwidGJzdHlsZSI6InRvcCIsImNhbkNvbW1lbnQiOmZhbHNlLCJkaWFncmFtVXJsIjoiIiwiY3N2RmlsZVVybCI6IiIsImJvcmRlciI6dHJ1ZSwibWF4U2NhbGUiOiIxIiwib3duaW5nUGFnZUlkIjoxNTY4NjA3NzAsImVkaXRhYmxlIjpmYWxzZSwiY2VvSWQiOjE1Njg2MDkwOSwicGFnZUlkIjoiIiwibGJveCI6dHJ1ZSwic2VydmVyQ29uZmlnIjp7ImVtYWlscHJldmlldyI6IjEifSwib2RyaXZlSWQiOiIiLCJyZXZpc2lvbiI6NSwibWFjcm9JZCI6IjQ5NTIyYjQ5LTRhYzktNGE2MC1iNjFiLWVmNTIwYWU3YzM0YSIsInByZXZpZXdOYW1lIjoiSW5ncmVzczJLYWZrYS5wbmciLCJsaWNlbnNlU3RhdHVzIjoiT0siLCJzZXJ2aWNlIjoiIiwiaXNUZW1wbGF0ZSI6IiIsIndpZHRoIjoiODU3Iiwic2ltcGxlVmlld2VyIjpmYWxzZSwibGFzdE1vZGlmaWVkIjoxNjcwMzI1MjA3MDAwLCJleGNlZWRQYWdlV2lkdGgiOmZhbHNlLCJvQ2xpZW50SWQiOiIifQ==
Test steps on an existing ServiceMesh cluster
- Add custom ports to istio-ingressgateway service
(https://www.dangtrinh.com/2019/09/how-to-open-custom-port-on-istio.html) - Modify onap-strimzi-kafka pods and services to disable TLS and set advertizedHosts
- Add "ingress" services to onap_strimzi
- "Add custom ports to istio-ingressgateway service"
1. Export existing service definition:
kubectl -n istio-ingress get service istio-ingressgateway -o yaml > istio_ingressgateway.yaml
2. Check existing Nodeports (The range of valid ports is 30000-32767)
kubectl get svc -A |grep Load
kubectl get svc -A |grep NodePort
3. Choose 4 free ports (e.g. 30900, 30901,30902, 30903)
4. Edit istio_ingressgateway.yaml and add:
- port: 9003
nodePort: 30903
targetPort: 9003
name: kafka-bootstrap
protocol: TCP
- port: 9000
nodePort: 30900
targetPort: 9000
name: kafka-0
protocol: TCP
- port: 9001
nodePort: 30901
targetPort: 9001
name: kafka-1
protocol: TCP
- port: 9002
nodePort: 30902
targetPort: 9002
name: kafka-2
protocol: TCP
5. Apply changes:
kubectl apply -f ./istio_ingressgateway.yaml
- "Modify onap-strimzi-kafka pods and services to disable TLS and set advertizedHosts"
1. Login to the K8S Control Node and set the helm environment
helm repo add local http://127.0.0.1:8879
helm plugin install --version v0.10.3 https://github.com/chartmuseum/helm-push.git
git config --global --add safe.directory /opt/oom
2. Modify the onap-strimzi config
cd /opt/oom/kubernetes
vi strimzi/templates/strimzi-kafka.yaml
Update "tls" and "authentication.type" of the "external" kafka listener:
---
- name: external
port: 9094
type: nodeport
tls: false
authentication:
type: {{ .Values.config.saslMechanism }}
configuration:
brokers:
- broker: 0
advertisedHost: kafka-api.simpledemo.onap.org
advertisedPort: 9000
- broker: 1
advertisedHost: kafka-api.simpledemo.onap.org
advertisedPort: 9001
- broker: 2
advertisedHost: kafka-api.simpledemo.onap.org
advertisedPort: 9002
3. Apply the changes to onap-strimzi
make strimzi
helm upgrade -i onap-strimzi local/strimzi --namespace onap --version 12.0.0 --values /opt/oom/kubernetes/onap/values.yaml --values /opt/oom/kubernetes/onap/resources/overrides/onap-all-ingress-istio.yaml --values /opt/oom/kubernetes/onap/resources/overrides/environment.yaml --values /home/ubuntu/oom/master/onap-overrides.yaml --timeout '900s'
- Create a file (e.g. kafka-ingress.yaml) Istio Ingress Gateway/VirtualService entries for the kafka-bootstrap-api and the brokers
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: kafka-bootstrap-api-gateway
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- kafka-bootstrap-api.simpledemo.onap.org
port:
name: tls-kafka-bootstrap
number: 9003
protocol: TLS
tls:
credentialName: ingress-tls-secret
mode: SIMPLE
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: kafka-bootstrap-api-service
spec:
hosts:
- kafka-bootstrap-api.simpledemo.onap.org
gateways:
- kafka-bootstrap-api-gateway
tcp:
- match:
- port: 9003
route:
- destination:
host: onap-strimzi-kafka-external-bootstrap
port:
number: 9094
---
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: kafka-api-gateway
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- kafka-api.simpledemo.onap.org
port:
name: tls-kafka-0
number: 9000
protocol: TLS
tls:
credentialName: ingress-tls-secret
mode: SIMPLE
- hosts:
- kafka-api.simpledemo.onap.org
port:
name: tls-kafka-1
number: 9001
protocol: TLS
tls:
credentialName: ingress-tls-secret
mode: SIMPLE
- hosts:
- kafka-api.simpledemo.onap.org
port:
name: tls-kafka-2
number: 9002
protocol: TLS
tls:
credentialName: ingress-tls-secret
mode: SIMPLE
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: kafka-0-api-service
spec:
hosts:
- kafka-api.simpledemo.onap.org
gateways:
- kafka-api-gateway
tcp:
- match:
- port: 9000
route:
- destination:
host: onap-strimzi-kafka-0
port:
number: 9094
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: kafka-1-api-service
spec:
hosts:
- kafka-api.simpledemo.onap.org
gateways:
- kafka-api-gateway
tcp:
- match:
- port: 9001
route:
- destination:
host: onap-strimzi-kafka-1
port:
number: 9094
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: kafka-2-api-service
spec:
hosts:
- kafka-api.simpledemo.onap.org
gateways:
- kafka-api-gateway
tcp:
- match:
- port: 9002
route:
- destination:
host: onap-strimzi-kafka-2
port:
number: 9094
kubectl -n onap apply -f ./kafka-ingress.yaml
- Add hostnames to DNS (or /etc/hosts) by using the IP Address of the istio-ingressgateway LB
sudo vi /etc/hosts
----
10.32.240.14 kafka-bootstrap-api.simpledemo.onap.org
10.32.240.14 kafka-api.simpledemo.onap.org
sudo apt install kafkacat
kafkacat -L -b kafka-bootstrap-api.simpledemo.onap.org:9003 -X security.protocol=sasl_ssl -X enable.ssl.certificate.verification=false -X sasl.mechanisms=SCRAM-SHA-512 -X sasl.username=<strimzi-user> -X sasl.password=<strimzi-password> -v