Question 11

Create a network policy named restrict-np to restrict to pod nginx-test running in namespace testing.
Only allow the following Pods to connect to Pod nginx-test:-
1. pods in the namespace default
2. pods with label version:v1 in any namespace.
Make sure to apply the network policy.
  • Question 12

    Context: Cluster: prod Master node: master1 Worker node: worker1
    You can switch the cluster/configuration context using the following command:
    [desk@cli] $ kubectl config use-context prod
    Task: Analyse and edit the given Dockerfile (based on the ubuntu:18:04 image) /home/cert_masters/Dockerfile fixing two instructions present in the file being prominent security/best-practice issues.
    Analyse and edit the given manifest file /home/cert_masters/mydeployment.yaml fixing two fields present in the file being prominent security/best-practice issues.
    Note: Don't add or remove configuration settings; only modify the existing configuration settings, so that two configuration settings each are no longer security/best-practice concerns. Should you need an unprivileged user for any of the tasks, use user nobody with user id 65535

    Question 13

    SIMULATION
    Create a new ServiceAccount named backend-sa in the existing namespace default, which has the capability to list the pods inside the namespace default.
    Create a new Pod named backend-pod in the namespace default, mount the newly created sa backend-sa to the pod, and Verify that the pod is able to list pods.
    Ensure that the Pod is running.

    Question 14

    Cluster: qa-cluster Master node: master Worker node: worker1 You can switch the cluster/configuration context using the following command: [desk@cli] $ kubectl config use-context qa-cluster Task: Create a NetworkPolicy named restricted-policy to restrict access to Pod product running in namespace dev. Only allow the following Pods to connect to Pod products-service: 1. Pods in the namespace qa 2. Pods with label environment: stage, in any namespace

    Question 15

    SIMULATION
    On the Cluster worker node, enforce the prepared AppArmor profile
    #include <tunables/global>
    profile nginx-deny flags=(attach_disconnected) {
    #include <abstractions/base>
    file,
    # Deny all file writes.
    deny /** w,
    }
    EOF'
    Edit the prepared manifest file to include the AppArmor profile.
    apiVersion: v1
    kind: Pod
    metadata:
    name: apparmor-pod
    spec:
    containers:
    - name: apparmor-pod
    image: nginx
    Finally, apply the manifests files and create the Pod specified on it.
    Verify: Try to make a file inside the directory which is restricted.