不赞成使用kubectl run-寻找替代方案 [英] kubectl run is deprecated - looking for alternative

查看:96
本文介绍了不赞成使用kubectl run-寻找替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用kubectl run和环境参数来为我创建临时docker容器(例如,出于调试目的的一些转发). 由于kubectl几周以来一直在抱怨kubectl run被弃用.不幸的是,我找不到合适的替代品.

I'm using kubectl run with environment parameters to create temporary docker containers for me (e.g. some forwarding for debugging purposes). Since several weeks kubectl is complaining about kubectl run being deprecated. Unfortunately I can't find an appropriate replacement.

这是旧命令:

$KUBECTL run -i -t --attach=false --image djfaze/port-forward --env="REMOTE_HOST=$REMOTE_HOST" --env="REMOTE_PORT=$REMOTE_PORT" $POD_NAME

发布此消息时,kubectl抱怨此消息:

When issuing this, kubectl complains with this message:

kubectl run --generator=deployment/apps.v1beta1已弃用,并将在以后的版本中删除.改用kubectl create.

kubectl run --generator=deployment/apps.v1beta1 is DEPRECATED and will be removed in a future version. Use kubectl create instead.

有什么想法如何替换此运行命令吗?

Any ideas how to replace this run command?

推荐答案

问题的作者让我解释一下此弃用背后的意图.就像布伦丹(Brendan)在他的答案中解释的那样,kubectl run本身并没有被弃用,只有所有发电机,除了那些为您创建一个Pod.

As the author of the problem let me explain a little bit the intention behind this deprecation. Just like Brendan explains in his answer, kubectl run per se is not being deprecated, only all the generators, except for the one that creates a Pod for you.

此更改的原因有两个方面:

The reason for this change is two folds:

  1. kubectl run命令的绝大多数输入参数对于新手和旧计时器来说都是压倒性的.弄清楚调用的结果并不容易.您需要考虑几个传递的选项以及服务器版本.

  1. The vast majority of input parameters for kubectl run command is overwhelming for newcomers, as well as for the old timers. It's not that easy to figure out what will be the result of your invocation. You need to take into consideration several passed options as well as the server version.

考虑到可能性矩阵的增长速度超出我们的处理能力,因此其背后的代码也很混乱.

The code behind it is also a mess to maintain given the matrix of possibilities is growing faster than we can handle.

这就是为什么我们试图使人们不再使用kubectl run进行日常工作,并说服他们使用显式kubectl create命令更简单.最后,我们希望使使用docker或任何其他容器引擎(在其中运行容器)的新手具有与Kubernetes相同的体验,其中kubectl run仅在集群中运行Pod.

That's why we're trying to move people away from using kubectl run for their daily workflows and convince them that using explicit kubectl create commands is more straightforward. Finally, we want to make the newcomers that played with docker or any other container engine, where they run a container, to have the same experience with Kubernetes where kubectl run will just run a Pod in a cluster.

对于最初的困惑,我们深表歉意.我希望这能解决问题.

Sorry for the initial confusion and I hope this will clear things up.

更新(2020/01/10):自 https://github.com/kubernetes /kubernetes/pull/87077 kubectl run将仅创建Pod.所有发电机将被完全移除.

UPDATE (2020/01/10): As of https://github.com/kubernetes/kubernetes/pull/87077 kubectl run will ONLY create Pods. All generators will be removed entirely.

这篇关于不赞成使用kubectl run-寻找替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆