728x90
docs : https://kubernetes.io/docs/concepts/services-networking/network-policies/
Network Policies
If you want to control traffic flow at the IP address or port level (OSI layer 3 or 4), NetworkPolicies allow you to specify rules for traffic flow within your cluster, and also between Pods and the outside world. Your cluster must use a network plugin tha
kubernetes.io
#k run curl --image=alpine/curl --rm -it --sh
#networkpolicy.yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: ingress-to-nptest
namespace: default
spec:
podSelector:
matchLabels:
run: np-test-1
policyTypes:
- Ingress
ingress:
ports:
- protocol: TCP
port: 80
k apply -f networkpolicy.yaml
728x90
'Cloud > CKA' 카테고리의 다른 글
[CKA] killer.sh ( Question 1 ~ Question 10 ) (0) | 2024.06.30 |
---|---|
[CKA] PSI Bridge 시험 환경 적응하기 (0) | 2024.06.28 |
[CKA] Mock Test - Trouble shooting ( Init:CrashLoopBackOff ) (0) | 2024.06.26 |
[CKA] Mock Test - DNS lookup (0) | 2024.06.25 |
[CKA] Mock Test - 사용자 생성 및 롤 바인딩 ( CSR , Rolebinding ) (0) | 2024.06.25 |