---
# System prepended metadata

title: 第八题 Stateless and Immutable Pod
tags: [真题讲解]

---

# 第八题 Stateless and Immutable Pod
###### tags: `真题讲解`

切换集群kubectl config use-context k8s
**Context**
lt is best-practice to design containers to best teless and immutable.

**Task**
lnspect Pods running in namespace **testing** and delete any Pod that is either **not stateless** or **not immutable**.
use the following strict interpretation of stateless and immutable:
* Pods being able to store data inside containers must be treated as not stateless.
* You don't have to worry whether data is actually stored inside containers or not already.
* Pods being configured to be privileged in any way must be treated as potentially not stateless and not immutable.

## 解法
根据题意, 凡事挂载了volume的和privileged的Pod都要被删除.
```
kubectl get pods NAME -n testing -o jsonpath={.spec.volume} | jq
kubectl get pods NAME -o yaml -n testing | grep "privi.*: true"
```
你可以用任意方法, get -oyaml或者describe pod去发现Pod声明的配置是否违规.
