问题描述
我正在使用json创建一个pod规范,运行时将为我在底层节点上提供一个外壳,如下所示。
overrides=$(cat <<EOF
{
"apiVersion": "v1","kind": "Pod","Metadata": {
"name": "admin-shell"
},"spec": {
"containers": [
{
"name": "admin-shell","securityContext": {
"privileged": true
},"image": "alpine:latest","args": ["chroot","/kdet","/bin/bash"],"stdin": true,"stdinOnce": true,"tty": true,"volumeMounts": [{
"name": "kdet","mountPath": "/kdet"
}]
}],"volumes": [{
"name": "kdet","hostPath": {
"path": "/","type": "Directory"
}
}]
}
}
EOF
)
kubectl run --image alpine:latest --rm --restart=Never --overrides="$foo" -ti test
If you don't see a command prompt,try pressing enter.
[root@admin-shell /]# exit
exit
pod "admin-shell" deleted
但是,当我尝试使用带有保存在api.json中的配置的curl启动Pod时,正在创建Pod,但是我没有上一步中的外壳。
>curl -k $APISERVER/api/v1/namespaces/default/pods \
-XPOST -H 'Content-Type: application/json' \
[email protected] \
--header "Authorization: Bearer $TOKEN"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2900 0 2250 100 650 13005 3757 --:--:-- --:--:-- --:--:-- 16763
{
"phase": "Pending","qosClass": "BestEffort"
}
您能帮我如何使用curl取得外壳吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)