Überprüfen der Namespace-Isolation
In diesem Schritt überprüfen Sie, ob die Webanwendung von den anderen Ressourcen im Cluster isoliert ist.
Erstellen Sie eine Datei namens other-app.yaml
mit folgendem Inhalt:
apiVersion: apps/v1
kind: Deployment
metadata:
name: other
spec:
replicas: 1
selector:
matchLabels:
app: other
template:
metadata:
labels:
app: other
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
In dieser Datei erstellen Sie ein weiteres Deployment namens other
im Standard-Namespace (default namespace), das einen Container mit dem nginx
-Image ausführt.
Wenden Sie das Deployment auf Ihren Cluster mit folgendem Befehl an:
kubectl apply -f other-app.yaml
Überprüfen Sie, ob das Deployment im Standard-Namespace läuft, mit folgendem Befehl:
kubectl get pods | grep other
Sie sollten den other
-Pod in der Liste der Pods sehen, die im Standard-Namespace laufen.