Get "Upgrade request required" from kubectl exec from Windows10/cygwin - kubernetes

For quite a while, I've been running kubectl v1.17 on Windows10/Cygwin to connect to the clusters for our application. Every once in a while, I use "kubectl exec" to perform an operation within a container. I've never had a problem doing this, until the last couple of days.
A couple of days ago, this attempt failed with "Upgrade request required". I talked to a colleague with a similar setup, and he hadn't been seeing this error. He was using v1.18, so I upgraded, and that seemed to fix the problem. I then used that for a few hours yesterday with no problem.
This morning, I'm getting "Upgrade request required" again, so the "upgrade" didn't actually fix it.
From the occurrences of this on the web, I see it has something to do with the connection handshake, but that's about all I know.
Our clusters are running v1.13.5 of k8s.
I tried running the command with "-v=10" to get more info.
The actual internal curl command that gets this appears to be this (with some elisions):
I0612 10:40:31.032729 10408 round_trippers.go:423] curl -k -v -XPOST -H "X-Stream-Protocol-Version: v4.channel.k8s.io" -H "X-Stream-Protocol-Version: v3.channel.k8s.io" -H "X-Stream-Protocol-Version: v2.channel.k8s.io" -H "X-Stream-Protocol-Version: channel.k8s.io" -H "User-Agent: kubectl.exe/v1.18.0 (windows/amd64) kubernetes/9e99141" -H "Authorization: Bearer ..." 'https://...'
Is there anything in this that might indicate what might be going wrong here?
Update:
I discovered this morning that the issue is definitely related to Cygwin. If I take the resulting "kubectl exec" command and execute in a Windows cmd shell, it works perfectly fine. No error.
A relevant portion of my "uname -a" string might be "3.1.5(0.340/5/3) 2020-06-01 08:59 x86_64 Cygwin".

Related

Postman works, but the "Code snippet" generated no. cURL

From my computer the query via postman to my endpoint works, it returns the expected result.
but the code generated by "code snippet" does not work, what could be the cause ?
--That code doesnt work. But in postman yes (same laptop)
curl --location --request POST 'https://service' \
--header 'Ocp-Apim-Subscription-Key: myKey' \
--header 'Content-Type: audio/mpeg' \
--data-binary '#/path/audio_test.mp3'
Error: curl: (28) Failed to connect to <service> port 443: Timed out
To check that it is not a problem with my end, I tried another service that works in postman and the code generated by postman through "code snippet" works as well.
-- That works in postman and in my consol --
curl --location --request POST 'https://´service' \
--header 'Key: myKey' \
--header 'Content-Type: application/json' \
--data-raw '{"text":"myText",
"language": "en"
}
'
its return the expected result
Does anyone have any idea where I could look? Thanks
curl: (28) Failed to connect to port 443: Timed out
This will likely be a connection error either due to the client context (application/terminal) or the client host (the device itself). I assume the second request doesn't try to hit the same location or it was ran from another context.
Check your connection first and then troubleshoot from your way up. To do so, in the same exact place you're running your curl run the following:
telnet service 443
Where service is the endpoint you are using in the request. If that still gives the same error then the issue is down to a networking problem. Check from other clients, check VPNs or other applications that could be causing the blockage.

Node not seeing funds

There was a transfer made which went through 72 hours ago, but the relay node is returning
No funds on the Address!
Is it because the node is not synced yet? Is there a way to verify the sync status?
assumed your cardano-node config file has set the default EKG port 12788,
you can query the node for the current BlockNo by executing this command on your local node
curl --silent -H 'Accept: application/json' 'http://127.0.0.1:12788/' | jq -r .cardano.node.metrics.blockNum.int.val
(You may first need to install jq on your system)
then go to https://pooltool.io/ and compare your nodes current value with the height reported there.

Eclipse Hono 1.1.1 Installed using Kubernetes - Probelm in Creating a Tenant

I have installed Eclipse Hono 1.1.1 Kubernetic cluster using Helm as per the below instructions.
https://hub.helm.sh/charts/eclipse-iot/hono
Initially I tried to create a tenant using the below command
curl -X POST "http://servername:28080/v1/tenants/DEFAULT_TENANT123" -H "accept: application/json" -H "Content-Type: application/json"
But then I got the Resource not found error.
And then as per the instructions in the How do i run curl command from within a Kubernetes pod
curl -X POST "http://ServiceName:Serviceport/v1/tenants/DEFAULT_TENANT123" -H "accept: application/json" -H "Content-Type: application/json"
Again it dint work..!!!
I tried the following command to enter into the device registry pod
kubectl exec -it honohelmdeploy-service-device-registry-0 -- sh
And inside the device registry pod, I tried to run the above command and still it dint work.
I am not sure what should be the Host and Port while using the below command
curl -X POST "http://HOST:PORT/v1/tenants/DEFAULT_TENANT123" -H "accept: application/json" -H "Content-Type: application/json"
I tried using device registry service name/ device registry pod name as hosts.
I tried using device registry ports
I tried using my server name / localhost as hosts..
I tried using 28080 as ports..
But I was not able to create a Tenant. Please assist.
Edited with the screeshot for kubectl get svc command
Ok, it seems like you have installed Hono to minikube without any loadbalancer running. You can see this from the EXTERNAL-IP column which contains <pending> for all of Hono's (externally visible) service endpoints.
You need to start minikube tunnel in order for these endpoints to be exposed via a loadbalancer as described in the chart's README. You should be able to run the minikube tunnel command either before or after having installed Hono to the cluster. Once the loadbalancer is running, the EXTERNAL-IP addresses should be bound and you should be able to access the service endpoints.

What would be Openshift REST API equivalent of a process template command

I am automating some continuous delivery processess that use openshift 3.5. They work fine from a command line, but I can hardly find any documentation of how the oc commands map to the OCP REST API. I've figured out how talk to the API and use what it directly offers. For example, I have a line:
oc process build-template -p APPLICATION_NAME=worldcontrol -n openshift | oc create -f - -n conspiracyspace
That takes a template named "build-template" from "openshift" namespace and processes it, piping the resulting definition to build a few objects like application image, into another namespace. I would appreciate an example of how this could be expressed in http request terms.
edit
Following #Graham's hint, here is what I got. First request is getting the contents of the template:
curl -k -v -XGET -H "User-Agent: oc/v3.5.5.15 (linux/amd64) openshift/4b5f317" -H "Authorization: Bearer ...." -H "Accept: application/json, */*" https://example.com/oapi/v1/namespaces/openshift/templates/build-template
Then apparently the oc client expands the parameters internally, and feeds the result into the POST:
curl -k -v -XPOST -H "Content-Type: application/json" -H "User-Agent: oc/v3.5.5.15 (linux/amd64) openshift/4b5f317" -H "Accept: application/json, */*" -H "Authorization: Bearer ...." https://example.com/oapi/v1/namespaces/openshift/processedtemplates
Run the oc command with the option --loglevel=10. This will show you what REST API calls it makes underneath and thus you can work out what you need to do to do the same thing with just the REST API. Do note that certain things may be partly done in the oc client, rather than delegating to a REST API endpoint call.
I did this, and at the very end of the output from the CLI, I saw this:
service "trade4-65869977-9d56-49a5-afa2-4a547df82d5c" created
deploymentconfig "trade4-65869977-9d56-49a5-afa2-4a547df82d5c" created
When piping to oc create -f -, then, the CLI must be inspecting the resulting template and creating each object in the objects array. No evidence of those calls were outputted to my command window, other than the two "created" statements.
So to fully automate this through the REST API, we would still need to parse that objects array returned by processtemplates and POST to the appropriate endpoints, correct?

Couchbase REST API vs CLI

I'm trying to use the REST API on Couchbase 2.2 and I'm finding two things that I cannot seem to do via REST:
Init a new cluster when no other nodes exist.
CLI version:
couchbase-cli cluster-init -u admin -p mypw -c localhost:8091 --cluster-init-ramsize=1024
Remove a healthy node from the cluster.
CLI version:
couchbase-cli rebalance -u admin -p mypw -c 10.10.1.10:8091 --server-remove=10.10.1.12
As for removing a node, I've tried:
curl -u admin:mypw -d otpNode=ns_1#10.10.1.12 \
http://10.10.1.10:8091/controller/ejectNode
Which returns: "Cannot remove active server."
I've also tried:
curl -s -u Administrator:myclusterpw \
-d 'ejectedNodes=ns_1%4010.10.1.12&knownNodes=ns_1%4010.10.1.10%2Cns_1%4010.10.1.11' \
http://10.10.1.10:8091/controller/rebalance
Which returns: {"mismatch":1} (presumably due to the node actually not being marked for ejection?)
Am I crazy, or are there no ways to do these things using curl?
I span up a two node cluster on aws (10.170.76.236 and 10.182.151.86), I was able to remove node 10.182.151.86 using the below curl request
curl -v -u Administrator:password -X POST 'http://10.182.151.86:8091/controller/rebalance' -d 'ejectedNodes=ns_1#10.182.151.86&knownNodes=ns_1#10.182.151.86,ns_1#10.170.76.236'
That removes the node and performs the rebalance leaving only '10.170.76.236' as the single node. Running this request below results in 'Cannot remove active server' as you have experienced.
curl -u Administrator:password -d otpNode=ns_1#10.170.76.236 http://10.170.76.236:8091/controller/ejectNode
This is because you can't remove the last node as you can't perform a rebalance, this issue is covered here http://www.couchbase.com/issues/browse/MB-7517
I left the real IP's in that I used so the curl requests are as clear as possible, I've terminated the nodes now though :)
Combo of:
curl -X POST -u admin:password -d username=Administrator \
-d password=letmein \
-d port=8091 \
http://localhost:8091/settings/web
and
curl -X POST -u admin:password -d memoryQuota=400 \
http://localhost:8091/pools/default
Ticket raised against this indicates that the ejectnode command itself won't work by design.
Server needs to either be pending or failover state to use that command seemingly