ErrorFetchingCatalog/ErrorListingServiceClasses on ServiceCatalog
On a multi-master setup with only the template service catalog (no ansible service catalog) I get:
service-catalog-controller-manager Error getting broker catalog: Get https://apiserver.openshift-template-service-broker.svc:443/brokers/template.openshift.io/v2/catalog: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
service-catalog-controller-manager Error listing service classes. the server could not find the requested resource (get clusterserviceclasses.servicecatalog.k8s.io)
Curling the api endpoint results int 404 most of the time. Templates are still visible on home page.
Version
Server https://openshift.XXX:443
openshift v3.9.0+ba7faec-1
kubernetes v1.9.1+a0ce1bc657
Steps To Reproduce
- curl -vvv https://openshift.XXX/apis/servicecatalog.k8s.io/v1beta1
Current Result
Sometimes I get 404 and sometimes I get the json. This happens on all 3 masters
Expected Result
Always get the JSON
Additional Information
Api server pods are fine.
Data
====
apiserver-config.yaml:
----
kind: TemplateServiceBrokerConfig
apiVersion: config.templateservicebroker.openshift.io/v1
templateNamespaces:
- openshift
Ok I found out that it is sometime having a timeout on the service apiserver in kuber-service-catalog.
For example doing curl https://apiserver.kube-service-catalog.svc:443 --insecure I will sometimes get timeouts.
The apiserver pods have a lot of http handshake error:
I0607 10:07:55.458944 1 wrap.go:42] GET /: (118.124µs) 200 [[Go-http-client/1.1] 10.128.0.1:41088] I0607 10:07:55.506393 1 wrap.go:42] GET /: (118.353µs) 200 [[Go-http-client/1.1] 10.129.0.1:40764] I0607 10:07:59.080845 1 logs.go:41] http: TLS handshake error from 10.131.0.1:38674: read tcp 10.128.0.10:6443->10.131.0.1:38674: read: connection timed out I0607 10:08:08.321676 1 wrap.go:42] GET /: (46.854748ms) 200 [[Go-http-client/1.1] 10.128.0.1:42186] I0607 10:08:11.368889 1 logs.go:41] http: TLS handshake error from 10.131.0.1:38684: read tcp 10.128.0.10:6443->10.131.0.1:38684: read: connection timed out
@jocelynthode when you are in this situation can you please check if the Catalog pods are being restarted or are in an error state? ie $ oc get pods -n kube-service-catalog
While you are at it, might as well do a describe and grab me the output please: oc describe all -n kube-service-catalog
I have a feeling we'll see restarts happening on one or both of the Catalog pods. Is the machine under heavy load?
@jboyd01
$ oc get pods -n kube-service-catalog
NAME READY STATUS RESTARTS AGE
apiserver-7zq5k 1/1 Running 0 20h
apiserver-csb6v 1/1 Running 0 17h
apiserver-zsz5r 1/1 Running 0 20h
controller-manager-2ngrz 1/1 Running 0 17h
controller-manager-h9hkm 1/1 Running 0 20h
controller-manager-zfs29 1/1 Running 0 20h
Here is the output of oc describe all -n kube-service-catalog: https://gist.github.com/jocelynthode/79388c71b212a466ecb33568211364ac
I do not see any restarts.
The machines should not be under heavy load as it is a clean install with no application pods running and no metrics/logging installation. Each master (3 total) has 8CPU / 24G of RAM
I agree @jocelynthode, this all looks healthy. Did you try the curl against the catalog apiserver during this time - were you getting timeouts?
You also said you were having issues with template service broker - those pods look fine as well? oc get pods -n openshift-template-service-broker ?
$ oc get pods -n openshift-template-service-broker
NAME READY STATUS RESTARTS AGE
apiserver-c6ng4 1/1 Running 0 1d
apiserver-zvlqt 1/1 Running 0 1d
I also noticed that doing : curl https://apiserver.kube-service-catalog.svc:443 --insecure from a master node sometimes results in timeout and sometimes list me the different paths.
@jboyd01 I'm really at a loss at what could cause this problem
Let's bypass the Service and see if each Catalog API Server is experiencing the same timeout issue. Could you please try curling each of these urls a handful of times and see if only a subset are failing with timeouts?
curl -vvv https://10.128.0.28:6443/apis/servicecatalog.k8s.io/v1beta1 --insecure curl -vvv https://10.129.0.29:6443/apis/servicecatalog.k8s.io/v1beta1 --insecure curl -vvv https://10.131.0.28:6443/apis/servicecatalog.k8s.io/v1beta1 --insecure
If you'd gather up the Service Catalog API Server pod logs (3 of them) I'll take a look. Might also be good to grab the 3 Service Catalog Controller Pod logs while you are at it.
How is etcd configured? Is it running on each of the 3 master nodes?
@jocelynthode What is the output of the following:
oc get apiservices servicecatalog.k8s.io -o yaml
oc get clusterservicebrokers
Thanks!
First, thanks for the all the help guys.
@jboyd01: You seem to be on something. When I curl directly the pods some fails. We have two subnets in two datacenters. These subnets are firewalled, but we have opened ANY/ANY on any ip in these subnets. However I can see that when from a master I try to curl a pod directly by its ip 10.128.0.31 for example and this pod resides on a node that is in the other subnet I get the timeout.
It looks like a firewall problem on our end then. However, I'm not sure I understand what is missing for this to work. I thought that the packet would be encapsulated and sent as if emanating from the master01 to the master02 in the second subnet. Are the ip source / ip destination different ?
@pmorie : As it appears it is related to some firewall problems. I don't see the need to post these results yet, but thanks for the pointers anyway !
good news, @jocelynthode, that certainly looks like the issue. I'm not in a position to give any guidance on the cross subnet routing, sorry.
@jboyd01 : Ok I tried to do a clean install (recreated hosts) and restarted the openshift ansible playbook as the network looked fine and the only explanation I could find is that somehow something got misconfigured during the installation. However it looks like I'm unable to register the TSB with the broker:
TASK [template_service_broker : Register TSB with broker] *********************************************************************************************************************************************************
fatal: [master01]: FAILED! => {"changed": true, "cmd": "oc process --config=/tmp/tsb-ansible-bgk81M/admin.kubeconfig -f \"/tmp/tsb-ansible-bgk81M/template-service-broker-registration.yaml\" --param CA_BUNDLE=\"[REMOVED FOR CONCICENESS]\" | oc apply --config=/tmp/tsb-ansible-bgk81M/admin.kubeconfig -f -", "delta": "0:00:00.904174", "end": "2018-06-15 15:45:03.763197", "msg": "non-zero return code", "rc": 1, "start": "2018-06-15 15:45:02.859023", "stderr": "error: unable to recognize servicecatalog.k8s.io/v1beta1, Kind=ClusterServiceBroker: no matches for servicecatalog.k8s.io/, Kind=ClusterServiceBroker", "stderr_lines": ["error: unable to recognize servicecatalog.k8s.io/v1beta1, Kind=ClusterServiceBroker: no matches for servicecatalog.k8s.io/, Kind=ClusterServiceBroker"], "stdout": "", "stdout_lines": []}
One specialty of my installation is that I do not want to install the ansible service broker, thus I have the following:
openshift_enable_service_catalog=true
openshift_template_service_broker_namespaces=['openshift']
ansible_service_broker_install=false
template_service_broker_install=true
template_service_broker_selector={"region": "infra"}
I didn't get this error the first time around as I had installed the ansible service broker (which I removed afterwards). Is the ansible service broker needed for the TSB to work ?
You don't need to install Ansible Service Broker. TSB and Service Catalog will work fine without it.
The new error you are seeing indicates the Service Catalog extension is not registered with Kubernetes. Can you try kubectl get apiservices and see if catalog is listed? Actually output from oc describe apiservices v1beta1.servicecatalog.k8s.io -n kube-service-catalog would be best.
You have verified the curl commands you did in comment 1 and 2 work ok now?
@jboyd01 I recreated the cluster from scratch again and this time I guess I was lucky during the ansible run as it was able to register the TSB.
I checked the commands:
- First one is having sometimes 404 as before. (probably when hitting a wrong combination of master -> nodes)
- Second one is having timeouts sometimes as well.
When I get a timeout the apiservice will say what is below:
Name: v1beta1.servicecatalog.k8s.io
Namespace:
Labels: <none>
Annotations: <none>
API Version: apiregistration.k8s.io/v1beta1
Kind: APIService
Metadata:
Creation Timestamp: 2018-06-18T07:16:36Z
Resource Version: 68430
Self Link: /apis/apiregistration.k8s.io/v1beta1/apiservices/v1beta1.servicecatalog.k8s.io
UID: 89b008c6-72c7-11e8-8ba7-0050569286d8
Spec:
Ca Bundle: <REDACTED>
Group: servicecatalog.k8s.io
Group Priority Minimum: 20
Service:
Name: apiserver
Namespace: kube-service-catalog
Version: v1beta1
Version Priority: 10
Status:
Conditions:
Last Transition Time: 2018-06-18T11:55:01Z
Message: no response from https://172.30.5.22:443: Get https://172.30.5.22:443: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Reason: FailedDiscoveryCheck
Status: False
Type: Available
Events: <none>
When I do not get a 404/Timeout the apiservices says:
Status:
Conditions:
Last Transition Time: 2018-06-18T12:08:19Z
Message: all checks passed
Reason: Passed
Status: True
Type: Available
Events: <none>
We're actually seeing a totally different issue but seemingly related. Sometimes when we take a master down by cordoning it and then stopping the services, we're seeing issues wherein the service itself is having issues. Sometimes we see the iptables on one of the remaining masters with literally no service nat rules at all for the kube-service-catalog/apiserver service. Sometimes, we'll see oc get all just hang with --loglevel=9 showing it's hanging on the /apis/servicecatalog.k8s.io/v1beta1 request but curls to the remaining two pods are both working fine (at least healthz and getting the core /apis/ URI). It's very strange and probably deserves a whole new issue if I can replicate it in a lab.
Oddly we'll see:
Jun 19 19:23:20 [redacted] origin-master-api[86630]: E0619 19:23:20.179218 1 memcache.go:153] couldn't get resource list for servicecatalog.k8s.io/v1beta1: the server could not find the requested resource
in the master-api logs, but it never seems to 'time out' and let things just move along with the oc get all.
Very strange indeed, though this has been an interesting deep dive into the way that iptables NAT rules create services with the whole probability at 33, then 50, and then default to get the 1/3 load balancing :)
@jboyd01 : I'm using the openshift-sdn multitenant, the kube-service-catalog has a NETID of 0 if it's any help.
@jboyd01 Here are some logs from the api service on one of the master. I can attest that UDP packets flow from one master to the other.
Jun 20 09:26:58 master01 atomic-openshift-master-api[80282]: E0620 09:26:57.570998 80282 available_controller.go:295] v1beta1.servicecatalog.k8s.io failed with: Operation cannot be fulfilled on apiservices.apiregistration.k8s.io "v1beta1.servicecatalog.k8s.io": the object has been modified; please apply your changes to the latest version and try again
Jun 20 09:26:58 master01 atomic-openshift-master-api[80282]: I0620 09:26:58.966286 80282 get.go:238] Starting watch for /api/v1/endpoints, rv=242803 labels= fields= timeout=6m22s
Jun 20 09:27:01 master01 atomic-openshift-master-api[80282]: I0620 09:27:01.233638 80282 controller.go:105] OpenAPI AggregationController: Processing item v1beta1.servicecatalog.k8s.io
Jun 20 09:27:01 master01 atomic-openshift-master-api[80282]: E0620 09:27:01.235704 80282 controller.go:111] loading OpenAPI spec for "v1beta1.servicecatalog.k8s.io" failed with: OpenAPI spec does not exists
Jun 20 09:27:01 master01 atomic-openshift-master-api[80282]: I0620 09:27:01.235724 80282 controller.go:119] OpenAPI AggregationController: action for item v1beta1.servicecatalog.k8s.io: Rate Limited Requeue.
Jun 20 09:27:01 master01 atomic-openshift-master-api[80282]: I0620 09:27:01.903303 80282 get.go:238] Starting watch for /api/v1/services, rv=100691 labels= fields= timeout=6m38s
Jun 20 09:27:02 master01 atomic-openshift-master-api[80282]: E0620 09:27:02.577430 80282 available_controller.go:295] v1beta1.servicecatalog.k8s.io failed with: Get https://172.30.5.22:443: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Jun 20 09:27:03 master01 atomic-openshift-master-api[80282]: E0620 09:27:03.857608 80282 memcache.go:153] couldn't get resource list for servicecatalog.k8s.io/v1beta1: the server could not find the requested resource
Jun 20 09:27:07 master01 atomic-openshift-master-api[80282]: E0620 09:27:07.626168 80282 available_controller.go:295] v1beta1.servicecatalog.k8s.io failed with: Get https://172.30.5.22:443: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Jun 20 09:27:08 master01 atomic-openshift-master-api[80282]: I0620 09:27:08.660445 80282 controller.go:105] OpenAPI AggregationController: Processing item v1beta1.servicecatalog.k8s.io
Jun 20 09:27:10 master01 atomic-openshift-master-api[80282]: I0620 09:27:10.371033 80282 controller.go:122] OpenAPI AggregationController: action for item v1beta1.servicecatalog.k8s.io: Nothing (removed from the queue).
Jun 20 09:27:12 master01 atomic-openshift-master-api[80282]: E0620 09:27:12.629922 80282 available_controller.go:295] v1beta1.servicecatalog.k8s.io failed with: Operation cannot be fulfilled on apiservices.apiregistration.k8s.io "v1beta1.servicecatalog.k8s.io": the object has been modified; please apply your changes to the latest version and try again
Jun 20 09:27:13 master01 atomic-openshift-master-api[80282]: I0620 09:27:13.884105 80282 controller.go:105] OpenAPI AggregationController: Processing item v1beta1.servicecatalog.k8s.io
Jun 20 09:27:13 master01 atomic-openshift-master-api[80282]: E0620 09:27:13.894099 80282 controller.go:111] loading OpenAPI spec for "v1beta1.servicecatalog.k8s.io" failed with: OpenAPI spec does not exists
Jun 20 09:27:13 master01 atomic-openshift-master-api[80282]: I0620 09:27:13.894617 80282 controller.go:119] OpenAPI AggregationController: action for item v1beta1.servicecatalog.k8s.io: Rate Limited Requeue.
Jun 20 09:27:17 master01 atomic-openshift-master-api[80282]: E0620 09:27:17.636769 80282 available_controller.go:295] v1beta1.servicecatalog.k8s.io failed with: Get https://172.30.5.22:443: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Jun 20 09:27:24 master01 atomic-openshift-master-api[80282]: I0620 09:27:24.213080 80282 controller.go:105] OpenAPI AggregationController: Processing item v1beta1.servicecatalog.k8s.io
Jun 20 09:27:25 master01 atomic-openshift-master-api[80282]: E0620 09:27:25.863418 80282 controller.go:111] loading OpenAPI spec for "v1beta1.servicecatalog.k8s.io" failed with: OpenAPI spec does not exists
Jun 20 09:27:25 master01 atomic-openshift-master-api[80282]: I0620 09:27:25.864198 80282 controller.go:119] OpenAPI AggregationController: action for item v1beta1.servicecatalog.k8s.io: Rate Limited Requeue.
Jun 20 09:27:27 master01 atomic-openshift-master-api[80282]: E0620 09:27:27.670807 80282 available_controller.go:295] v1beta1.servicecatalog.k8s.io failed with: Operation cannot be fulfilled on apiservices.apiregistration.k8s.io "v1beta1.servicecatalog.k8s.io": the object has been modified; please apply your changes to the latest version and try again
However I did notice in the firewalld service these errors :
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C DOCKER -i docker0 -j RETURN' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -D FORWARD -i docker0 -o docker0 -j DROP' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -i docker0 -o docker0 -j ACCEPT' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -i docker0 ! -o docker0 -j ACCEPT' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C PREROUTING -m addrtype --dst-type LOCAL -j DOCKER' failed: iptables: No chain/target/match by that name.
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -C OUTPUT -m addrtype --dst-type LOCAL -j DOCKER ! --dst 127.0.0.0/8' failed: iptables: No chain/target/match by that name.
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -o docker0 -j DOCKER' failed: iptables: No chain/target/match by that name.
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -t filter -C FORWARD -j DOCKER-ISOLATION' failed: iptables: No chain/target/match by that name.
Jun 19 10:42:00 master03 firewalld[1126]: WARNING: COMMAND_FAILED: '/usr/sbin/iptables -w2 -D FORWARD -i docker0 -o docker0 -j DROP' failed: iptables: Bad rule (does a matching rule exist in that chain?).
Is this normal behavior ?
Both are using the firewalld service
@jocelynthode: I believe the first set of log msgs you posted from the master-api are "normal". OpenAPI AggregationController messages with Service Catalog can be ignored - catalog is not integrated with OpenAPI at this point.
With regard to this log entry Get https://172.30.5.22:443: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) That is the IP of the Catalog APIServer service isn't it? We shouldn't be seeing this. I'd check the apiserver service endpoints and see what it reports, validate that you can infact access each of the servers it is trying to route you to (oc get endpoints -n kube-service-catalog apiserver)
When all pods are up, you are able to curl against every Catalog apiserver pod and you don't have timeout issues now? "Do not pass go" until you are at this point - - you should be able to access all Catalog API Server pods with curl from every node. If you can't, we need to address this before anything else.
I am a bit suspect about SDN, routing and the Catalog APIServer service. Perhaps getting the apiserver endpoints (oc get endpoints -n kube-service-catalog apiserver) would be more telling when you see the issue described in https://github.com/openshift/origin/issues/19931#issuecomment-398558399. I'm thinking perhaps the Catalog apiserver service's endpoints are not being set correctly. It would be good to validate that at all times the apiservice endpoints are correct - that they include only the correct set of pods and that they all are up and you can curl against them (just curling https://w.x.y.z:6443/ should give you a response).
I'm told the SDN pod logs may shed some light on routing though I don't have direct experience with it yet (ie the sdn pods in the openshift-sdn namespace) - you may have to look through a bunch of them before you find the active pod.
You may already be aware, but iptables-save can help narrow in if this is a routing problem.
This deployment is on AWS?
@mshutt that is really interesting what you are seeing. May be related. Is this on AWS? Do you have SDN configured?
Sometimes, we'll see oc get all just hang with --loglevel=9 showing it's hanging on the /apis/servicecatalog.k8s.io/v1beta1 request but curls to the remaining two pods are both working fine (at least healthz and getting the core /apis/ URI). It's very strange and probably deserves a whole new issue if I can replicate it in a lab.
Can you clarify "but curls to the remaining two pods are both working fine" ? Do you mean the same command, or if you curl against the catalog APIServer pod directly? One of the catalog apiserver pods is deliberately down and hangs if you curl against it?
I'd be very curious to get a oc describe endpoints -n kube-service-catalog apiserver when you are in this problem area. Also iptables-save. And if you are using SDN, it would be good to zip up the sdn pods in the openshift-sdn namespace. My suspicion here is that the service is listing a "bad" apiserver that is down or can't be routed to.
Sometimes, we'll see oc get all just hang with --loglevel=9 showing it's hanging on the /apis/servicecatalog.k8s.io/v1beta1
This sounds very much like intermittent network/sdn issues to me.
@mshutt would you mind creating a distinct issue for the problem you're hitting? Your problem and @jocelynthode's definitely sound related, but having a distinct issue will help us keep the exact symptoms straight and debug effectively.