Question 5 of pratice test manual scheduling

Hello everyone.

Just I have a question about the pratice test manual scheduling.

I would like to change node01 to controlplane by using a POST request.

So this is my command and I have an issue :

curl --header “Content-Type:application/json” --request POST --data ‘{“apiVersion”: “v1”, “kind”:“Binding”, …}’ http://$SERVER/api/v1/namespaces/default/pods/$PODNAME/binding/

Could you help me ? In the course, we have a simple explication and no a real applied example.

Thank you so much.

Best regards,

yori

Try the following steps

kubectl create -f nginx.yml

Check all possible clusters, as you .KUBECONFIG may have multiple contexts:

kubectl config view -o jsonpath=‘{“Cluster name\tServer\n”}{range .clusters[*]}{.name}{“\t”}{.cluster.server}{“\n”}{end}’

Select name of cluster you want to interact with from above output:

export CLUSTER_NAME=“some_server_name”

Point to the API server referring the cluster name

export APISERVER=“https://master-ip:6443

Gets the token value:

TOKEN=$(kubectl get secrets -o jsonpath=“{.items[?(@.metadata.annotations[‘kubernetes.io/service-account.name’]==‘default’)].data.token}”|base64 --decode)

#Send the post request
curl -H “Content-Type:application/json” --request POST --data ‘{
“apiVersion”: “v1”,
“kind”: “Binding”,
“metadata”: {
“name”: “nginx”
},
“target”: {
“apiVersion”: “v1”,
“kind”: “Node”,
“name”: “node01”
}
}’ $APISERVER/api/v1/namespaces/default/pods/nginx/binding/ --header “Authorization: Bearer $TOKEN” --insecure

Thank you for your response. But cannot you give us the exact command ? Because it’s from your plateform.

Thank you