Reputation: 417
The definition of the pod which is taken from https://github.com/mesosphere/kubernetes-mesos/blob/master/examples/pod-nginx.json
{
"kind":"Pod",
"apiVersion":"v1beta1",
"id":"nginx-id-01",
"desiredState":{
"manifest":{
"version":"v1beta1",
"containers":[
{
"name":"nginx-01",
"image":"dockerfile/nginx",
"ports":[
{
"containerPort":80,
"hostPort":31000
}
],
"livenessProbe":{
"enabled":true,
"type":"http",
"initialDelaySeconds":30,
"httpGet":{
"path":"/index.html",
"port":"8081"
}
}
}
]
}
},
"labels":{
"name":"foo",
"cluster":"gce"
}
}
I cant seem to find how can you specify resources.
Upvotes: 0
Views: 1439
Reputation: 99
You can specify the cpu or resources for any container in the deployment file itself in your container specification .
nano task2deploy1.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: task2deploy1
spec:
replicas: 1
template:
metadata:
labels:
app: task2deploy1
spec:
containers:
- name: task2deploy1
image: nginx
ports:
- containerPort: 80
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
This means the request of 64Mi memory and 250m cpu can be sent to container named task2deploy1.
The container although has a limit of 128Mi memory and 500m cpu.
kubectl create –f task2deploy1.yaml –namespace=Shifali
Once you create pods with the help of this deployment the pod will have these resources as per mentioned in the deployment file .
kubectl describe pod task2deploy1-765cfc9b89-xrgsr --namespace=Shifali
Name: task2deploy1-765cfc9b89-xrgsr
Limits:
cpu: 500m
memory: 128Mi
Requests:
cpu: 250m
memory: 64Mi
along with this more information would be displayed but what need to see is the resources.
Upvotes: 0
Reputation: 1729
Officially, you can add a resource field in each container definition in your pod, you can add requests and limits:
resources:
requests:
memory: "qMi"
cpu: "pm"
limits:
memory: "yMi"
cpu: "x"
The sum of these values is then summed up with other containers in the pod to calculate the total request and limit per pod.
Please take a look at https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
Upvotes: 0
Reputation: 399
You can enter values for memory & CPU in your container spec: https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/api/v1beta1/types.go#L257
Our scheduler doesn't do much with them yet, but it also doesn't completely ignore them any more.
Upvotes: 1
Reputation: 4322
You can see examples of Kubernetes resources being specified at https://github.com/GoogleCloudPlatform/kubernetes/blob/master/examples/guestbook/frontend-controller.json#L16
However, Kubernetes (hence Kubernetes-Mesos) doesn't really do anything with these resources yet, as per https://github.com/GoogleCloudPlatform/kubernetes/issues/168
Once this is implemented in Kubernetes, the Kubernetes-Mesos framework will support it as well: https://github.com/mesosphere/kubernetes-mesos/issues/76
Upvotes: 1