Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam CKA topic 1 question 19 discussion

Actual exam question from CNCF's CKA
Question #: 19
Topic #: 1
[All CKA Questions]

SIMULATION
-






Task
-

Create a new NetworkPolicy named allow-port-from-namespace in the existing namespace echo.

Ensure that the new NetworkPolicy allows Pods in namespace internal to connect to port 9200/tcp of Pods in namespace echo.

Further ensure that the new NetworkPolicy:

• does not allow access to Pods, which don't listen on port 9200/tcp
• does not allow access from Pods, which are not in namespace internal

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
learndigitalcloud
1 month ago
I think so this is the correct answer : apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-port-from-namespace namespace: echo spec: podSelector: {} policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: internal ports: - protocol: TCP port: 9200
upvoted 1 times
...
fungchan012
2 months, 1 week ago
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-port-from-namespace namespace: echo spec: podSelector: {} policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: name: internal ports: - protocol: TCP port: 9200
upvoted 1 times
...
fc146fc
2 months, 2 weeks ago
kubectl create ns echo ( if this is not created) kubectl create ns internal kubectl label ns internal namespace=internal apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-port-from-namespace namespace: echo spec: podSelector: {} policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: namespace: internal ports: - protocol: TCP port: 9200
upvoted 3 times
...
skywalker
5 months, 1 week ago
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-port-from-namespace namespace: echo spec: policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: name: internal ## Ensure "name=internal" exists when "k get ns --show-labels" ports: - protocol: TCP port: 9200
upvoted 3 times
GCPCloudArchitectUser
2 months, 2 weeks ago
you are nissing pod-selector here , please find the answer below from abu7mldan
upvoted 1 times
...
...
abu7midan
5 months, 1 week ago
k create ns echo k label ns echo part=echo k apply -f np.yaml apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-port-from-namespace namespace: echo spec: policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: project: myproject - podSelector: matchLabels: part: echo ports: - protocol: TCP port: 9200
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...