반응형
작업 클러스터: hk8s
Create a new NetworkPolicy named allow-port-from-namespace in the exiting namespace devops.
Ensure that the new NetworkPolicy allow pods in namespace migops to connect to port 80 of Pods in namespace devops.
kubectl get namespaces migops --show-labels
: 강의에 의하면 labels에는 team=migops
kubectl get namespace devops --show-labels
: 강의에 의하면 labels에는 team=devops
k get pod -n devops --show-labels
NAME LABELS
web app=web
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-port-from-namespace
namespace: devops
spec:
podSelector:
matchLabels:
app: web
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
team: migops
- podSelector: {}
ports:
- protocol: TCP
port: 80
728x90
반응형
'cloud > k8s(문제풀이)' 카테고리의 다른 글
[따배쿠29]Kube-DNS (0) | 2022.09.01 |
---|---|
[cka] Mock exam-1 (0) | 2022.08.19 |
[따배쿠 CKA]28. ServiceAccount Cluster Role binding (0) | 2022.08.17 |
[따배쿠 CKA]27. ServiceAccount Role Binding (0) | 2022.08.17 |
[따배쿠 CKA] 26.User Cluster Role binding (0) | 2022.08.17 |