Question 6

SIMULATION
A container image scanner is set up on the cluster.
Given an incomplete configuration in the directory
/etc/Kubernetes/confcontrol and a functional container image scanner with HTTPS endpoint https://acme.local.8081/image_policy
1. Enable the admission plugin.
2. Validate the control configuration and change it to implicit deny.
Finally, test the configuration by deploying the pod having the image tag as the latest.
  • Question 7

    SIMULATION
    Analyze and edit the given Dockerfile
    FROM ubuntu:latest
    RUN apt-get update -y
    RUN apt-install nginx -y
    COPY entrypoint.sh /
    ENTRYPOINT ["/entrypoint.sh"]
    USER ROOT
    Fixing two instructions present in the file being prominent security best practice issues Analyze and edit the deployment manifest file apiVersion: v1 kind: Pod metadata:
    name: security-context-demo-2
    spec:
    securityContext:
    runAsUser: 1000
    containers:
    - name: sec-ctx-demo-2
    image: gcr.io/google-samples/node-hello:1.0
    securityContext:
    runAsUser: 0
    privileged: True
    allowPrivilegeEscalation: false
    Fixing two fields present in the file being prominent security best practice issues Don't add or remove configuration settings; only modify the existing configuration settings Whenever you need an unprivileged user for any of the tasks, use user test-user with the user id 5487
  • Question 8

    SIMULATION
    use the Trivy to scan the following images,
    1. amazonlinux:1
    2. k8s.gcr.io/kube-controller-manager:v1.18.6
    Look for images with HIGH or CRITICAL severity vulnerabilities and store the output of the same in /opt/trivy-vulnerable.txt
  • Question 9

    SIMULATION
    Before Making any changes build the Dockerfile with tag base:v1
    Now Analyze and edit the given Dockerfile(based on ubuntu 16:04)
    Fixing two instructions present in the file, Check from Security Aspect and Reduce Size point of view.
    Dockerfile:
    FROM ubuntu:latest
    RUN apt-get update -y
    RUN apt install nginx -y
    COPY entrypoint.sh /
    RUN useradd ubuntu
    ENTRYPOINT ["/entrypoint.sh"]
    USER ubuntu
    entrypoint.sh
    #!/bin/bash
    echo "Hello from CKS"
    After fixing the Dockerfile, build the docker-image with the tag base:v2 To Verify: Check the size of the image before and after the build.