Kubernetes 如何将GKE上k-native的最小刻度设置为1?

Kubernetes 如何将GKE上k-native的最小刻度设置为1?,kubernetes,google-kubernetes-engine,knative-serving,knative,Kubernetes,Google Kubernetes Engine,Knative Serving,Knative,我在GKE上的k8s集群上安装了k-native。现在我正在运行一个测试 因为我在GKE上运行,并且为集群24/7付费,所以将部署扩展到零并始终对第一个请求进行冷启动是没有意义的 到目前为止我尝试过的内容列表 运行kubectl-n knative service edit cm config autoscaler,然后将enable scale to zero标志从“true”更改为“false” Rankubectl annotate——如中所述覆盖svc helloworld-go-5jm

我在GKE上的k8s集群上安装了k-native。现在我正在运行一个测试

因为我在GKE上运行,并且为集群24/7付费,所以将部署扩展到零并始终对第一个请求进行冷启动是没有意义的

到目前为止我尝试过的内容列表

  • 运行
    kubectl-n knative service edit cm config autoscaler
    ,然后将
    enable scale to zero
    标志从“true”更改为“false”
  • Ran
    kubectl annotate——如中所述覆盖svc helloworld-go-5jm9r autoscaling.knative.dev/minScale=“1”
  • 运行
    kubectl注释——覆盖svc helloworld-go-5jm9r autoscaling.knative.dev/class-
    作为我自己的一个实验
  • 无论我做了什么修改,HelloWorld的播客都会因为没有更多的呼叫进入而终止

    $kubectl获得订单——手表
    名称就绪状态重新启动
    helloworld-go-5jm9r-deployment-847d6fdb49-njktv 2/2运行0 13秒
    helloworld-go-5jm9r-deployment-847d6fdb49-njktv 2/2终端0 96s
    helloworld-go-5jm9r-deployment-847d6fdb49-njktv 1/2端接0 99s
    helloworld-go-5jm9r-deployment-847d6fdb49-njktv 0/2端接0 118s

    正确地将minScale因子设置为1应该可以让pod永远保持活力,我错了吗

    人们说这里和那里都有“设置一个自定义的小刻度”选项,但我无法安装。我错过了什么?例如,我们欢迎运行具体的命令


    第二次尝试:

    $ kubectl annotate --overwrite revision helloworld-go-5jm9r autoscaling.knative.dev/minScale="1"
    revision.serving.knative.dev/helloworld-go-5jm9r annotated
    
    $ kubectl describe revision
    Name:         helloworld-go-5jm9r
    Namespace:    default
    Labels:       serving.knative.dev/configuration=helloworld-go
                  serving.knative.dev/configurationGeneration=1
                  serving.knative.dev/service=helloworld-go
    Annotations:  autoscaling.knative.dev/minScale: 1
                  serving.knative.dev/lastPinned: 1560488757
    (..omit..)
    
    $ kubectl get po --watch
    NAME                                              READY   STATUS    RESTARTS   AGE
    helloworld-go-5jm9r-deployment-65dd4cc9d4-4hhrw   2/2     Running   0          19s
    helloworld-go-5jm9r-deployment-65dd4cc9d4-4hhrw   2/2   Terminating   0     98s
    helloworld-go-5jm9r-deployment-65dd4cc9d4-4hhrw   1/2   Terminating   0     101s
    helloworld-go-5jm9r-deployment-65dd4cc9d4-4hhrw   0/2   Terminating   0     2m
    
    注释修订并没有使发射的吊舱保持活力。。。有什么想法吗


    答复:

    它是
    PodAutoscaler
    ,不是服务或修订版

    $ kubectl annotate --overwrite PodAutoscaler helloworld-go-5jm9r autoscaling.knative.dev/minScale="2"
    podautoscaler.autoscaling.internal.knative.dev/helloworld-go-5jm9r annotated
    
    $ kubectl describe  PodAutoscaler
    Name:         helloworld-go-5jm9r
    Namespace:    default
    Labels:       app=helloworld-go-5jm9r
                  serving.knative.dev/configuration=helloworld-go
                  serving.knative.dev/configurationGeneration=1
                  serving.knative.dev/revision=helloworld-go-5jm9r
                  serving.knative.dev/revisionUID=706b4f42-8be6-11e9-a475-42010a920158
                  serving.knative.dev/service=helloworld-go
    Annotations:  autoscaling.knative.dev/class: kpa.autoscaling.knative.dev
                  autoscaling.knative.dev/metric: concurrency
                  autoscaling.knative.dev/minScale: 2
    (..omit..)
    
    $ kubectl get po --watch
    NAME                                              READY   STATUS              RESTARTS   AGE
    helloworld-go-5jm9r-deployment-65dd4cc9d4-6rtr9   0/2     ContainerCreating   0          2s
    helloworld-go-5jm9r-deployment-65dd4cc9d4-pqvcz   2/2     Running             0          116s
    helloworld-go-5jm9r-deployment-65dd4cc9d4-6rtr9   1/2   Running   0     4s
    helloworld-go-5jm9r-deployment-65dd4cc9d4-6rtr9   2/2   Running   0     4s
    
    添加到
    修订版
    对象,但您正在注释
    服务
    对象,这就是它不起作用的原因

    尝试列出所有
    修订版
    对象

    kubectl get revision
    
    并注释您感兴趣的对象,使用与将
    服务

    注释到
    修订版
    对象相同的命令,但注释的是
    服务
    对象,这就是它不起作用的原因

    尝试列出所有
    修订版
    对象

    kubectl get revision
    

    并使用与注释
    服务时使用的相同命令注释您感兴趣的对象。注释必须添加到
    PodAutoscaler
    对象中

    kubectl annotate --overwrite PodAutoscaler helloworld-go-5jm9r autoscaling.knative.dev/minScale="2"
    
    或者,您可以在yaml配置文件上设置minScale,如中所述


    必须将注释添加到
    PodAutoscaler
    对象中

    kubectl annotate --overwrite PodAutoscaler helloworld-go-5jm9r autoscaling.knative.dev/minScale="2"
    
    或者,您可以在yaml配置文件上设置minScale,如中所述