[英]How to add memory resources to the running pods in kubernetes
I have created 2 replicas of pods using the deployment declarative method in kubernetes by using the following command 我通过使用以下命令在kubernetes中使用部署声明方法创建了两个Pod副本
$ kubectl create -f app-deployment.yaml
It created 2 pods of my java web application in one of the node. 它在一个节点中创建了2个Java Web应用程序容器。 I want to specify memory resources for those pods. 我想为这些容器指定内存资源。 I know that we can specify memory resources to the pods by running the below script. 我知道我们可以通过运行以下脚本来为Pod指定内存资源。
apiVersion: v1
kind: Pod
metadata:
name: app1
spec:
containers:
- image: app:v1
name: app1
resources:
limits:
memory: 300Mi
requests:
memory: 200Mi
ports:
- containerPort: 8080
hostPort: 8082
When i run the above script, a new pod with the name app1 gets created with the memory specified. 当我运行上述脚本时,将使用指定的内存创建名为app1的新容器。
But how do i specify the memory resources for the pods created using the deployment script which i ran initially ? 但是,如何为使用最初运行的部署脚本创建的Pod指定内存资源?
Any help on this would be appreciable. 在这方面的任何帮助将是可观的。
Specify the same spec in the containers
section of your deployment.yaml . 在deployment.yaml的containers
部分中指定相同的规格。 The pods will get restarted with the new resource limits. 吊舱将使用新的资源限制重新启动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.