Пропатчить все деплойменты
#
kubectl get deploy -o custom-columns=:.metadata.name | xargs -I_ -n1 kubectl patch deploy _ -p '{"spec":{"revisionHistoryLimit":2}}'
Пример конфига для логина через oidc (keycloak)
#
- name: oidc
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- oidc-login
- get-token
- --oidc-issuer-url=https://key.example.com/auth/realms/example
- --oidc-client-id=kubernetes
- --oidc-client-secret=2f36109b-736a-4085-aa81-71e0e3b1bef6
command: kubectl
env: null
provideClusterInfo: false
Эфемерные контейнеры
#
kubectl debug -it EXISTINGPODNAME --image=alpine:latest --target=EXISTINGCONTAINERNAME
ps
cd /proc/1/root # If container master process is running with PID 1
ls
# если контейнер крешится
kubectl debug EXISTINGPODNAME -it --image=alpine:latest --share-process --copy-to=for-debug
# шелл на ноде
kubectl debug node/NODENAME -it --image=alpine:latest
VPA
#
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: prometheus-vpa
spec:
targetRef:
apiVersion: "apps/v1"
updatePolicy:
updateMode: "Initial"
containerPolicies:
- containerName: "*"
minAllowed:
cpu: 0m
memory: 0Mi
maxAllowed:
cpu: 1
memory: 500Mi
controlledResources: ["cpu", "memory"]
controlledValues: RequestsAndLimits