2

Working through some samples in Knative in Action and have run into the following error trying to set minimum CPI and RAM:

Omers-MacBook-Pro-2:Knative development$ kn service update hello-example --request 'cpu=500m,memory=256Mi'
Error: giving up after 3 retries: admission webhook "validation.webhook.serving.knative.dev" denied the request: validation failed: Saw the following changes without a name change (-old +new): spec.template.metadata.name
{*v1.RevisionTemplateSpec}.Spec.PodSpec.Containers[0].Resources.Requests:
    -: "map[]"
    +: "map[cpu:{i:{value:500 scale:-3} d:{Dec:<nil>} s:500m Format:DecimalSI} memory:{i:{value:268435456 scale:0} d:{Dec:<nil>} s: Format:BinarySI}]"

Run 'kn --help' for usage

I've also tried (as the book suggests):

Omers-MacBook-Pro-2:Knative development$ kn service update hello-example --requests-cpu 500m --requests-memory 256Mi

But this format seems to be deprecated.

Any ideas as to why this may be failing?

2 Answers2

0

What I suspect is that the kn CLI is sending the request and is not compatible with the version of knative serving

Make sure the version of the kn CLI is compatible with the version of knative serving you have installed. I suggest it be safe to have the same versions.

For example, I was able to get your example working using the kn CLI v0.21 using knative serving v0.21

you can check with kn version

kn version

Version:      v0.21.0
Supported APIs:
- serving.knative.dev/v1 (knative-serving v0.21.0)

What I did to reproduce use konk and kn CLI Download the kn CLI binary v0.21 from here https://github.com/knative/client/releases/tag/v0.21.0 Then install kind 0.10 from here https://github.com/kubernetes-sigs/kind/releases/tag/v0.10.0

Then install knative on kind (konk) https://konk.dev it takes less than 5 minutes

curl -sL get.konk.dev | bash

konk comes with a serving and eventing sample apps.

Run the update command for the resource requests

kn service update hello --request 'cpu=500m,memory=256Mi'

You will see the following output

Updating Service 'hello' in namespace 'default':

  0.053s The Configuration is still working to reflect the latest desired specification.
 11.497s Traffic is not yet migrated to the latest revision.
 11.608s Ingress has not yet been reconciled.
 11.829s Waiting for load balancer to be ready
 11.986s Ready to serve.

Service 'hello' updated to latest revision 'hello-00002' is available at URL:
http://hello.default.127.0.0.1.nip.io
csantanapr
  • 5,002
  • 2
  • 19
  • 15
0

It looks like you are trying to us a newer version of the kn tool against a Service created by an older version of the kn tool. In release 0.21, there was a switch from client-side to server-side naming support.

As a one-time transition from the client-side to the server-side naming, you may need to run:

kn service update hello-example --revision-name ""

You can combine this with an existing update like so, if you wish:

kn service update hello-example --revision-name "" --request "cpu=500m,memory=256Mi"

Note that clearing the client-generated revision name will create a new Revision (and potentially roll it out) on the server side, since the name is part of the revision template on the server.

E. Anderson
  • 3,405
  • 1
  • 16
  • 19