Completed upto lesson 28
This commit is contained in:
93
lab/lesson-8-answer.yaml
Normal file
93
lab/lesson-8-answer.yaml
Normal file
@@ -0,0 +1,93 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: cks-net-hard
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ledger
|
||||
namespace: cks-net-hard
|
||||
spec:
|
||||
selector:
|
||||
app: ledger
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: ledger
|
||||
namespace: cks-net-hard
|
||||
labels:
|
||||
app: ledger
|
||||
spec:
|
||||
containers:
|
||||
- name: ledger
|
||||
image: busybox:1.37
|
||||
command: ["sh", "-c", "mkdir -p /www; echo ledger > /www/index.html; httpd -f -p 8080 -h /www"]
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: checkout
|
||||
namespace: cks-net-hard
|
||||
labels:
|
||||
app: checkout
|
||||
spec:
|
||||
containers:
|
||||
- name: checkout
|
||||
image: busybox:1.37
|
||||
command: ["sh", "-c", "sleep 3600"]
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: intruder
|
||||
namespace: cks-net-hard
|
||||
labels:
|
||||
app: intruder
|
||||
spec:
|
||||
containers:
|
||||
- name: intruder
|
||||
image: busybox:1.37
|
||||
command: ["sh", "-c", "sleep 3600"]
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: cks-net-hard
|
||||
namespace: cks-net-hard
|
||||
spec:
|
||||
podSelector: {}
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app: checkout
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8080
|
||||
egress:
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app: ledger
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8080
|
||||
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app: checkout
|
||||
ports:
|
||||
- port: 53
|
||||
protocol: TCP
|
||||
- port: 53
|
||||
protocol: UDP
|
||||
|
||||
Reference in New Issue
Block a user