echo 'name: faascontroller
kind: FaaSController
provider: knative # FaaS provider kind, currently we only support Knative
syncInterval: 10s
httpServer:
http3: false
port: 10083
keepAlive: true
keepAliveTimeout: 60s
maxConnections: 10240
knative:
networkLayerURL: http://${knative_kourier_clusterIP}
hostSuffix: example.com ' | egctl create -f -
name: "demo"
image: "gcr.io/knative-samples/helloworld-go" # you can change this to any pullable image
port: 8080 # image exposes port 8080
autoScaleType: "concurrency"
autoScaleValue: "100"
minReplica: 0
maxReplica: 1
limitCPU: "1000m"
limitMemory: "1000Mi"
requestCPU: "80m"
requestMemory: "20Mi"
requestAdaptor:
header:
set:
X-Func: demo
/home/easegress/function.yaml
, using command to deploy it in Easegress:$ curl --data-binary @/home/easegress/function.yaml -X POST -H 'Content-Type: text/vnd.yaml' http://127.0.0.1:2381/apis/v2/faas/faascontroller
Note this command should be run in Easegress' instance environment and 2381 is the default admin traffic port. If your Easegress instance uses different port, please change 2381 to the correct port.
active
status$ curl http://127.0.0.1:2381/apis/v2/faas/faascontroller/demo
spec:
name: demo
image: gcr.io/knative-samples/helloworld-go
port: 8080
autoScaleType: concurrency
autoScaleValue: "100"
minReplica: 0
maxReplica: 1
limitCPU: 1000m
limitMemory: 1000Mi
requestCPU: 80m
requestMemory: 20Mi
requestAdaptor:
host: ""
method: ""
header:
del: []
set:
X-Func: demo
add: {}
body: ""
compress: ""
decompress: ""
status:
name: demo
state: active
event: ready
extData: {}
fsm: null
X-FaaS-Func-Name: demo
in the HTTP header.
Note: this example's container image gcr.io/knative-samples/helloworld-go
serves on path /
. For different function images, the path might differ.$ curl http://127.0.0.1:10083 -H "X-FaaS-Func-Name: demo"
Hello World!
name: demo
#...
limitedMemory: "200Mi"
limitedCPU: "180m"
requireMemory: "100Mi"
requireCPU: "100m"
minReplica: 0
maxReplica: 50
For the full YAML, see here
Add the configuration above in #Scenario 1's /home/easegress/function.yaml
$ curl http://127.0.0.1:2381/apis/v2/faas/faascontroller/demo/stop -X PUT
inactive
then we can update the resource limitation safely.$ curl --data-binary @/home/easegress/function.yaml -X PUT -H 'Content-Type: text/vnd.yaml' http://127.0.0.1:2381/apis/v2/faas/faascontroller/demo
active
name: demo
#...
minReplica: 1
#...
Modifying the minReplica
above in #Scenario 1's /home/easegress/function.yaml
Update the function spec and verify it as in Scenario 2's steps 2 - 3.
RPS
based autoscaling is a good choice.name: demo
#...
autoScaleType: "rps"
autoScaleValue: "6000"
#...
Modifying the autoScaleType
and autoScaleValue" above in #Scenario 1's
/home/easegress/function.yaml`
Update the function spec and verify it as in Scenario 2's step 2 - 3.
name: demo
image: "${image_url}"
port: 8089
autoScaleType: "concurrency"
autoScaleValue: "100
limitedMemory: "200Mi"
limitedCPU: "180m"
requireMemory: "100Mi"
requireCPU: "100m"
minReplica: 0
maxReplica: 50
name: demo
image: "${image_url}"
port: 8089
autoScaleType: "concurrency"
autoScaleValue: "100"
limitedMemory: "200Mi"
limitedCPU: "180m"
requireMemory: "100Mi"
requireCPU: "100m"
minReplica: 1
maxReplica: 50
name: demo
image: "${image_url}"
port: 8089
autoScaleType: "rps"
autoScaleValue: "6000"
limitedMemory: "200Mi"
limitedCPU: "180m"
requireMemory: "100Mi"
requireCPU: "100m"
minReplica: 0
maxReplica: 50
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )