问题标签 [kubernetes-pod]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
7816 浏览

docker - Kubernetes节点设备端口(USB)映射到POD?或者 Swarm 服务——设备映射

是否可以将工作节点的设备端口(USB 端口)映射到 POD?如同docker create --device=/dev/ttyACM0:/dev/ttyACM0

可能吗?我检查了参考文档,但找不到任何东西。

在 Docker 服务中,是否可以映射--device port到服务容器(如果我只运行 1 个容器)?

0 投票
2 回答
1332 浏览

docker - Kubernetes 部署、Pod 和容器概念

我最近开始熟悉 Kubernetes,但是虽然我确实了解了这个概念,但我有一些问题我无法通过 Kubernetes 的概念文档清楚地回答,还有一些我想确认的理解。

  • Deployment是一组部署在 Pod 中的一个或多个容器镜像(Docker ..etc),通过 Kubernetes 部署控制器监控和创建、更新或删除此类部署。

  • Pod是一组一个或多个容器,这些容器是来自同一个部署,还是来自多个部署?

  • “一个 pod 模型包含一个或多个相对紧密耦合的应用程序容器”。关于何时在同一个 pod 中而不是单独的 pod 中部署容器是否有明确的标准?

  • “Pod 是可在 Kubernetes 中创建和管理的最小可部署计算单元”- Pods,Kuberenets 文档。这是否意味着 Kubernetes API 无法监控和管理容器(至少直接)?

感谢您的意见。

0 投票
3 回答
53265 浏览

deployment - 如何配置 Kubernetes 多 Pod 部署

我想通过 k8s 部署对象管理我的部署来部署应用程序集群。文档让我非常困惑。我的基本布局具有以下独立缩放的组件:

  1. API 服务器
  2. 用户界面服务器
  3. Redis 缓存
  4. 定时器/计划任务服务器

从技术上讲,以上 4 个都属于独立扩展的独立 pod。

我的问题是:

  1. 我是否需要创建pod.yml文件,然后以某种方式在文件中引用它们,deployment.yml或者部署文件也可以嵌入 pod 定义?
  2. K8s 文档似乎暗示 的spec部分Deployment相当于定义一个pod。那是对的吗?如果我想以声明方式描述多 pod 部署怎么办?我是否需要多个 deployment.yml 文件?
0 投票
3 回答
56874 浏览

kubernetes - 在 kubernetes pod 中执行多个命令(或从 shell 脚本)

我正在编写一个 shell 脚本,它需要登录到 pod 并在 kubernetes pod 中执行一系列命令。

下面是我的 sample_script.sh:

运行此脚本后,我没有得到任何输出。任何帮助将不胜感激

0 投票
1 回答
2190 浏览

kubernetes - oc delete pod 是如何工作的?

我想知道 oc delete pod 命令运行时发生了什么。想知道宽限期之前和之后发生的步骤。我知道默认的宽限期是 30 秒,但有时这样做会发生超时(我猜是 500 秒)并且 pod 不会被删除。为了克服这个问题,我们使用 oc delete pod --grace-period=0 那么它现在是如何被删除的,而之前它却被超时了呢?

0 投票
2 回答
1218 浏览

kubernetes - OpenShift - 豆荚如何相互解析名称

我正在尝试在 openshift 上安装 cloudera 管理器和 cloudera 代理,为了运行安装,我需要让所有 pod 相互通信。

我手动修改了管理器上的 /etc/hosts 并添加了所有代理,并在代理上添加了管理器和所有其他代理。

现在我想自动化这个,假设我添加了一个新代理,我希望它解析管理器和主机(我可以通过将管理器名称作为环境变量传递并使用 shell 脚本添加来完成它的一部分它到 /etc/hosts,不是理想的方式,但仍然是解决方案)。但是第二部分会更难,让经理解决每个新代理,并解决同一服务上的所有其他代理。

我想知道是否有办法让集群上的每个 pod 都可以解析其他名称?

我必须使用一个 pod 为 cloudera-manager 提供服务,并为另一个服务 cloudera-agent 提供 - 让我们说 - 3 个代理。

你有什么主意吗 ?

谢谢你。

0 投票
1 回答
1353 浏览

elasticsearch - 使用 Kubernetes 在 Elasticsearch 集群中进行持久卷映射

我们计划使用 Kubernetes 建立一个 ES 集群。k8s pod 将包含 3 个数据节点,我们打算为数据提供持久的卷映射。

我是 ES 和 k8s 的新手,但据我了解,在 pod 中,通常共享一个卷。但是在这种情况下,我们不应该共享 3 个实例的数据。为 pod 实现卷映射的最佳方法是什么。如果我有 3 个实例,我应该像 /node1/data、/node2/data 那样单独映射每个实例,还是应该只映射到单个卷 '/data' 并且 ES 将确保实例之间的数据是隔离的?

我不确定映射卷是否应该具有节点名称,如 node1、node2 等,如上所述。拥有 3 个 ES 节点(或多个数据节点)的 Pod 设计是否正确?您可以为 pod 中的不同节点实例指定不同的持久卷吗?

如果 pod 被终止并创建了一个新的 pod,会发生什么?映射卷和节点名之间是否存在强绑定。实现这一目标的最佳实践是什么?

0 投票
6 回答
63629 浏览

kubernetes - Kubernetes 按年龄对 Pod 进行排序

我可以使用以下方法按名称对我的 Kubernetes pod 进行排序:

如何按年龄对它们(或其他资源)进行排序kubectl

0 投票
1 回答
360 浏览

kubernetes - 如何部署 Kube-Controller-Master?

我已经用 minikube 安装了 Kubernetes,它是一个单节点集群。有一个 yaml 文件来部署控制器主控,但它显示

后退重启失败的容器 同步 pod 错误

有人可以解决这个问题吗?

yaml 文件的链接在这里https://github.com/kubernetes/kubernetes.github.io/blob/master/docs/admin/high-availability/kube-controller-manager.yaml

0 投票
2 回答
8342 浏览

service - Kubernetes service with clustered PODs in active/standby

Apologies for not keeping this short, as any such attempt would make me miss-out on some important details of my problem.

I have a legacy Java application which works in a active/standby mode in a clustered environment to expose certain RESTful WebServices via a predefined port.

If there are two nodes in my app cluster, at any point in time only one would be in Active mode, and the other in Passive mode, and the requests are always served by the node with app running in Active mode. 'Active' and 'Passive' are just roles, the app as such would be running on both nodes. The Active and Passive instances communicate with each other through this same predetermined port.

Suppose I have a two node cluster with one instance of my application running on each node, then one of the instance would initially be active and the other will be passive. If for some reason the active node goes for a toss for some reason, the app instance in other node identifies this using some heartbeat mechanism, takes over the control and becomes the new active. When the old active comes back up it detects the other guy has owned up the new Active role, hence it goes into Passive mode.

The application manages to provide RESTful webservices on the same endpoint IP irrespective of which node is running the app in 'Active' mode by using a cluster IP, which piggy-backs on the active instance, so the cluster IP switches over to whichever node is running the app in Active mode.

I am trying to containerize this app and run this in a Kubernetes cluster for scale and ease of deployment. I am able to containerize and able to deploy it as a POD in a Kubernetes cluster.

In order to bring in the Active/Passive role here, I am running two instances of this POD, each pinned to a separate K8S nodes using node affinity (each node is labeled as either active or passive, and POD definitions pin on these labels), and clustering them up using my app's clustering mechanism whereas only one will be active and the other will be passive.

I am exposing the REST service externally using K8S Service semantics by making use of the NodePort, and exposing the REST WebService via a NodePort on the master node.

Here's my yaml file content:

Everything seems working fine, except that since both PODs are exposing the web service via same port, the K8S Service is routing the incoming requests to one of these PODS in a random fashion. Since my REST WebService endpoints work only on Active node, the service requests work via K8S Service resource only when the request is getting routed to the POD with app in Active role. If at any point in time the K8S Service happens to route the incoming request to POD with app in passive role, the service is inaccessible/not served.

How do I make this work in such a way that the K8S service always routes the requests to POD with app in Active role? Is this something doable in Kubernetes or I'm aiming for too much?

Thank you for your time!