Sitemap
The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +772K followers.

Follow publication

Make your Kubernetes cluster bulletproof.

7 min readOct 25, 2019

--

Problem description

Solution theory

Practice example.

❯(⎈) kubectl run --generator=run-pod/v1 --image=bash bashpod/bash created

❯(⎈) kubectl get pod bash -o yaml
apiVersion: v1
kind: Pod
metadata:
labels:
run: bash
name: bash
namespace: default
spec:
containers:
- image: bash
name: bash
resources: {}
❯(⎈) kubectl run --generator=run-pod/v1 --image=bash bash -n regularpod/bash created

❯(⎈) kubectl get pod bash -o yaml -n regular
apiVersion: v1
kind: Pod
metadata:
annotations:
kubernetes.io/limit-ranger: 'LimitRanger plugin set: cpu, memory request for container
bash; cpu, memory limit for container bash'
labels:
run: bash
name: bash
namespace: regular
spec:
containers:
- image: bash
name: bash
resources:
limits:
cpu: 700m
memory: 900Mi
requests:
cpu: 500m
memory: 512Mi
❯(⎈) kubectl run --generator=run-pod/v1 --image=bash bash -n lightweightpod/bash created

❯(⎈) kubectl get pods -n lightweight bash -o yaml
apiVersion: v1
kind: Pod
metadata:
annotations:
kubernetes.io/limit-ranger: 'LimitRanger plugin set: cpu, memory request for container
bash; cpu, memory limit for container bash'
labels:
run: bash
name: bash
namespace: lightweight
spec:
containers:
- image: bash
name: bash
resources:
limits:
cpu: 700m
memory: 900Mi
requests:
cpu: 500m
memory: 512Mi
- type: Container
max:
cpu: "200m"
memory: "250Mi"
❯(⎈) kubectl run --generator=run-pod/v1 --image=bash bash -n lightweightError from server (Forbidden): pods "bash" is forbidden: [maximum cpu usage per Container is 200m, but limit is 700m., maximum memory usage per Container is 250Mi, but limit is 900Mi.]

Conclusion.

--

--

The Startup
The Startup

Published in The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +772K followers.

Dmitrii Evstiukhin
Dmitrii Evstiukhin

No responses yet