As per the documentation, https://github.com/snapcore/snapd/wiki/REST-API#post-v2snaps
I am trying to install kubectl
with the curl command
sudo curl --unix-socket /run/snapd.socket -H "Content-Type: application/json" -X POST -d '{"action": "install", "snaps": ["kubectl"], "classic": true}' http://localhost/v2/snaps | jq .
but it gives an error like:
{
"type": "error",
"status-code": 400,
"status": "Bad Request",
"result": {
"message": "snap \"kubectl\" requires classic confinement",
"kind": "snap-needs-classic",
"value": "kubectl"
}
}