create_upstream
Configure and deploy an upstream service with load balancing, health checks, and timeout settings using customizable algorithms for efficient traffic management.
Instructions
Create an upstream service with load balancing settings
Input Schema
Name | Required | Description | Default |
---|---|---|---|
id | No | upstream id | |
upstream | Yes | upstream service configuration object |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "upstream id",
"type": "string"
},
"upstream": {
"additionalProperties": true,
"description": "upstream service configuration object",
"properties": {
"checks": {
"additionalProperties": false,
"description": "health check configuration",
"properties": {
"active": {
"additionalProperties": false,
"description": "active health check configuration",
"properties": {
"healthy": {
"additionalProperties": false,
"properties": {
"interval": {
"description": "check interval for healthy status",
"type": "number"
},
"successes": {
"description": "success count threshold",
"type": "number"
}
},
"type": "object"
},
"host": {
"description": "host for health check",
"type": "string"
},
"http_path": {
"description": "HTTP path for health check",
"type": "string"
},
"https_verify_certificate": {
"description": "verify HTTPS certificate",
"type": "boolean"
},
"port": {
"description": "port for health check",
"type": "number"
},
"timeout": {
"description": "timeout for health check",
"type": "number"
},
"unhealthy": {
"additionalProperties": false,
"properties": {
"http_failures": {
"description": "HTTP failure count threshold",
"type": "number"
},
"interval": {
"description": "check interval for unhealthy status",
"type": "number"
}
},
"type": "object"
}
},
"type": "object"
},
"passive": {
"additionalProperties": false,
"description": "passive health check configuration",
"properties": {
"healthy": {
"additionalProperties": false,
"properties": {
"http_statuses": {
"description": "HTTP status codes for healthy state",
"items": {
"type": "number"
},
"type": "array"
},
"successes": {
"description": "success count threshold",
"type": "number"
}
},
"type": "object"
},
"unhealthy": {
"additionalProperties": false,
"properties": {
"http_failures": {
"description": "HTTP failure count threshold",
"type": "number"
},
"http_statuses": {
"description": "HTTP status codes for unhealthy state",
"items": {
"type": "number"
},
"type": "array"
},
"timeout": {
"description": "timeout threshold",
"type": "number"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
},
"desc": {
"description": "upstream description",
"maxLength": 256,
"type": "string"
},
"hash_on": {
"description": "hash on type for chash algorithm",
"enum": [
"vars",
"header",
"cookie",
"consumer",
"vars_combinations"
],
"type": "string"
},
"keepalive_pool": {
"additionalProperties": false,
"description": "keepalive pool configuration",
"properties": {
"idle_timeout": {
"default": 60,
"description": "idle timeout",
"type": "number"
},
"requests": {
"default": 1000,
"description": "requests",
"type": "number"
},
"size": {
"default": 320,
"description": "size",
"type": "number"
}
},
"type": "object"
},
"key": {
"description": "hash key for chash algorithm",
"type": "string"
},
"labels": {
"additionalProperties": {
"type": "string"
},
"description": "upstream labels",
"type": "object"
},
"name": {
"description": "upstream name",
"type": "string"
},
"nodes": {
"description": "upstream nodes with weights",
"items": {
"additionalProperties": false,
"properties": {
"host": {
"description": "upstream host",
"type": "string"
},
"port": {
"description": "upstream port",
"type": "number"
},
"priority": {
"description": "upstream priority",
"minimum": 0,
"type": "number"
},
"weight": {
"description": "upstream weight",
"minimum": 0,
"type": "number"
}
},
"required": [
"host",
"port"
],
"type": "object"
},
"type": "array"
},
"pass_host": {
"default": "pass",
"description": "host passing mode",
"enum": [
"pass",
"node",
"rewrite"
],
"type": "string"
},
"retries": {
"description": "retry count",
"minimum": 0,
"type": "number"
},
"retry_timeout": {
"description": "retry timeout",
"minimum": 0,
"type": "number"
},
"scheme": {
"default": "http",
"description": "upstream scheme",
"enum": [
"http",
"https",
"grpc",
"grpcs",
"tcp",
"tls",
"udp",
"kafka"
],
"type": "string"
},
"timeout": {
"additionalProperties": false,
"description": "timeout configuration",
"properties": {
"connect": {
"description": "connection timeout in seconds",
"type": "number"
},
"read": {
"description": "read timeout in seconds",
"type": "number"
},
"send": {
"description": "send timeout in seconds",
"type": "number"
}
},
"type": "object"
},
"tls": {
"additionalProperties": false,
"description": "TLS configuration",
"properties": {
"client_cert": {
"description": "TLS certificate",
"type": "string"
},
"client_cert_id": {
"description": "TLS certificate id",
"items": {
"type": "string"
},
"type": "array"
},
"client_key": {
"description": "TLS key",
"type": "string"
},
"verify": {
"description": "TLS verification",
"type": "boolean"
}
},
"type": "object"
},
"type": {
"default": "roundrobin",
"description": "load balancing algorithm",
"enum": [
"roundrobin",
"chash",
"ewma",
"least_conn"
],
"type": "string"
},
"upstream_host": {
"description": "upstream host for rewrite mode",
"type": "string"
}
},
"required": [
"nodes"
],
"type": "object"
}
},
"required": [
"upstream"
],
"type": "object"
}