joshualyon commented on issue #2267:
URL:
https://github.com/apache/apisix-ingress-controller/issues/2267#issuecomment-2652385312
I'm experiencing what appears to be a similar issue. The logs show an error
similar to what @martin-schulze-e2m mentioned where one of the logged errors
says it failed to get the upstream where there is `_service` appended to the
name it's trying to look up and the automatically created upstream (from the
ApisixRoute) doesn't have the `_service` appended.
Interestingly, the upstream **does** successfully get updated with the
`healthCheck.active.httpPath` specified in the associated `ApisixUpstream`, so
it seems like the APISIX Ingress Controller might be updating things
successfully using the correct name, but perhaps is also trying using other
conventions like the `_service` suffixed name, hash id, etc? 🤔
> [!WARNING]
> While that wouldn't be a major issue if the Apisix Ingress Controller
tried the additional conventions a handful of times, it seems like it **will
endlessly retry and fills up the `apisix-ingress-controller` logs**.
For reference, I verified the upstreams by port forwarding 9180 from the
`apisix-admin` service and doing a simple curl against the admin API like:
```
curl http://127.0.0.1:9180/apisix/admin/upstreams -H 'X-API-Key:
{YOUR-ADMIN-KEY}' | jq .
```
_(where the default admin key is `edd1c9f034335f136f87ad84b625c8f1` if you
haven't changed it)_
## Logs
```
warn apisix/apisix_upstream.go:489 sync ApisixUpstream failed, will retry
{"object":
{"Type":4,"Object":{"Key":"default/httpbin-ngx-svc","OldObject":null,"GroupVersion":"apisix.apache.org/v2"},"OldObject":null,"Tombstone":null},
"error": "not found"}
error apisix/apisix_upstream.go:333 failed to get upstream
default_httpbin-ngx-svc_80_service: not found
warn apisix/cluster.go:1164 upstream not found {"id": "e9357f4d", "url":
"http://apisix-admin.ingress-apisix.svc.cluster.local:9180/apisix/admin/upstreams/e9357f4d",
"cluster": "default"}
```
# Example Resources
#### `app-hello-deploy.yaml`
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpbin-ngx-deploy
labels:
app: httpbin-ngx
spec:
replicas: 3 # Adjust the number of replicas as needed
selector:
matchLabels:
app: httpbin-ngx
template:
metadata:
labels:
app: httpbin-ngx
spec:
containers:
- name: httpbin-ngx
image: nginxdemos/hello:latest
```
#### `app-hello-svc.yaml`
```
apiVersion: v1
kind: Service
metadata:
name: httpbin-ngx-svc
labels:
app: httpbin-ngx # label for better resource grouping and querying
spec:
selector:
app: httpbin-ngx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP
```
#### `apisix-route-test.yaml`
```
apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
name: route-hello-test
spec:
http:
- name: hello-test
match:
hosts:
- hello-test.demo.com
paths:
- /*
# Use a Kubernetes Service directly as the backend
backends:
- serviceName: httpbin-ngx-svc
servicePort: 80
```
#### `apisix-upstream-test.yaml`
```
apiVersion: apisix.apache.org/v2
kind: ApisixUpstream
metadata:
name: httpbin-ngx-svc # match the service name
spec:
healthCheck:
active:
type: http # default: http
httpPath: /foo?health=4
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]