Difference between revisions of "Cka command snippets"
Jump to navigation
Jump to search
(Created page with "Little command snippets ``` apiVersion: apps/v1 kind: DaemonSet metadata: name: configurator namespace: configurator spec: selector: matchLabels: name: config...") |
|||
| Line 79: | Line 79: | ||
- port: 53 | - port: 53 | ||
protocol: UDP | protocol: UDP | ||
| + | ``` | ||
| + | |||
| + | ## podantiaffinity | ||
| + | |||
| + | ``` | ||
| + | apiVersion: v1 | ||
| + | kind: Pod | ||
| + | metadata: | ||
| + | labels: | ||
| + | level: test | ||
| + | name: test | ||
| + | spec: | ||
| + | containers: | ||
| + | - image: nginx:alpine | ||
| + | name: test | ||
| + | affinity: | ||
| + | podAntiAffinity: | ||
| + | requiredDuringSchedulingIgnoredDuringExecution: | ||
| + | - labelSelector: | ||
| + | matchExpressions: | ||
| + | - key: level | ||
| + | operator: In | ||
| + | values: | ||
| + | - restricted | ||
| + | topologyKey: kubernetes.io/hostname | ||
| + | |||
| + | or | ||
| + | |||
| + | ... | ||
| + | affinity: | ||
| + | podAntiAffinity: | ||
| + | requiredDuringSchedulingIgnoredDuringExecution: | ||
| + | - labelSelector: | ||
| + | matchLabels: | ||
| + | level: restricted | ||
| + | topologyKey: kubernetes.io/hostname | ||
``` | ``` | ||
Revision as of 20:31, 12 January 2025
Little command snippets
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: configurator
namespace: configurator
spec:
selector:
matchLabels:
name: configurator
template:
metadata:
labels:
name: configurator
spec:
containers:
- name: configurator
image: bash
command: ['bash', '-c', 'echo aba997ac-1c89-4d64 | tee /configurator/config && sleep 1d']
volumeMounts:
- name: my-mount
mountPath: /configurator
volumes:
- name: my-mount
hostPath:
path: /configurator
kubectl expose deploy/asia --port=80
kubectl create ingress world --class=nginx \
--annotation nginx.ingress.kubernetes.io/rewrite-target=/ \
--rule="world.universe.mine/europe*=europe:80" \
--rule="world.universe.mine/asia*=asia:80"
alias k=kubectl
source /etc/bash_completion
source <(kubectl completion bash)
complete -F __start_kubectl k
controlplane $ k get pod
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: np
namespace: space2
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: space1
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: np
namespace: space1
spec:
podSelector: {}
policyTypes:
- Egress
egress:
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: space2
- ports:
- port: 53
protocol: TCP
- port: 53
protocol: UDP
podantiaffinity
apiVersion: v1
kind: Pod
metadata:
labels:
level: test
name: test
spec:
containers:
- image: nginx:alpine
name: test
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: level
operator: In
values:
- restricted
topologyKey: kubernetes.io/hostname
or
...
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
level: restricted
topologyKey: kubernetes.io/hostname