The following creates a new upstream called api.example.internal:
_format_version: '3.0'
upstreams:
- name: api.example.internal
tags:
- user-level
- low-priority
algorithm: round-robin
To create a upstream, call the Admin API’s /upstreams endpoint.
curl -X POST http://localhost:8001/upstreams/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "api.example.internal",
"tags": [
"user-level",
"low-priority"
],
"algorithm": "round-robin"
}
'
Upstreams are automatically generated by Kong Ingress Controller based on the Kubernetes API server state.
Upstream behaviuour can be customized in KIC using the KongUpstreamPolicy
resource:
apiVersion: configuration.konghq.com/v1beta1
kind: KongUpstreamPolicy
metadata:
name: sample-customization
konghq.com/tags: user-level, low-priority
spec:
algorithm: round-robin
To use the upstream configuration, it needs to be associated with a Service
:
kubectl patch service my-sample-service -p '{"metadata":{"annotations":{"konghq.com/upstream-policy":"sample-customization"}}}'