Error: unknown flag: --scale-up-delay See 'kubectl create --help' for usage.
时间: 2024-05-29 10:12:40 浏览: 28
This error message appears when you run a kubectl command with an unknown flag or option. In this case, the flag "--scale-up-delay" is not recognized by the kubectl create command.
To resolve this error, you can check the kubectl create command documentation using the "kubectl create --help" command to see if the "--scale-up-delay" flag is supported. If it is not supported, you may need to use a different command or option to achieve the desired result.
相关问题
Error: unknown flag: --overrides See 'kubectl scale --help' for usage.
非常抱歉,我犯了错误。在较早版本的 kubectl 中,确实有 `--overrides` 选项,但在新版本中已被废弃。在新版本中,可以使用 `--patch` 选项来更新 Pod 模板的规范。以下是正确的命令:
```
kubectl patch deployment tomcat-deployment -p '{"spec": {"replicas": 2, "template": {"spec": {"nodeSelector": {"kubernetes.io/hostname": "node2"}}}}}'
```
在这个命令中,我们使用 `patch` 命令和 JSON 格式的 `--patch` 选项更新了 `tomcat-deployment` 部署的 Pod 模板规范。在 `--patch` 中,我们指定了 Pod 模板中的节点选择器,该选择器将 Pod 调度到具有标签 `kubernetes.io/hostname: node2` 的节点上。同时,我们还将 Pod 副本数增加到 2 个。
Error: unknown flag: --node-selector See 'kubectl scale --help' for usage.
非常抱歉,是我的错误。在 `kubectl scale` 命令中没有 `--node-selector` 这个选项。正确的命令应该是使用 `--overrides` 选项来指定节点选择器,具体命令如下:
```
kubectl scale --replicas=2 deployment/tomcat-deployment --selector="app=tomcat" --overrides='{ "apiVersion": "apps/v1", "spec": { "template": { "spec": { "nodeSelector": { "kubernetes.io/hostname": "node2" } } } } }'
```
其中,`replicas=2`表示将pod的数量扩展到2个,`deployment/tomcat-deployment`表示部署的名称,`--selector="app=tomcat"`表示选择具有标签`app=tomcat`的pod进行扩容,`--overrides` 选项指定节点选择器。在 `--overrides` 中,我们使用了一个 JSON 对象来覆盖 Pod 模板的规范。该 JSON 对象指定了一个节点选择器,该选择器将 Pod 调度到具有标签 `kubernetes.io/hostname: node2` 的节点上。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)