Admission Controller
This feature is offered through Sysdig Labs and is installed as its own component. See Admission Controller: Installation
Features
Kubernetes’ Admission Controllers (AC) help you define and customize which requests are allowed on your cluster.
An admission controller intercepts and processes requests to the Kubernetes API prior to persistence of the object, but after the request is authenticated and authorized.
Installing this component will enable the following:
Image Scanning Capabilities: Sysdig’s Admission Controller (UI-based) builds upon Kubernetes and enhances the capacity of the image scanner to check images for Common Vulnerabilities and Exposures (CVEs), misconfigurations, outdated images, etc., elevating the scan policies from detection to actual prevention. Container images that do not fulfill the configured admission policies will be rejected from the cluster before being assigned to a node and allowed to run.
Kubernetes Audit Logging Capabilities: Enable the
features.k8sAuditDetections=true
option to use Kubernetes audit logging features with the admission controller. (See also: Kubernetes Audit Logging.)
AC Image Scanning - Usage Steps
The Admission Controller is installed per-cluster. The workflow is straightforward:
Installation:
Enable the feature in Sysdig Labs to activate it in the Sysdig Secure backend, for image scanning.
Install the Admission Controller in the target cluster(s) and verify that it appears in the Sysdig UI as “Connected.”
Usage:
- Create Admission Controller policies as you see fit for your use cases
- Assign the policies to the connected clusters
- Enable the Admission Controller for the cluster
Create Policies
Admission Controller Policies define the criteria to accept or reject a given container image at admission time. Remember that Policies must be assigned to a cluster to be enforced.
Log in as Administrator to Sysdig Secure and select
Image Scanning> Admission Controller|Policies
.The Admission Controller Policies page displays a list of any previously defined policies.
Click
+Policy
and enter a meaningfulName
andDescription
.Define the policy
Rules
:Evaluation Failure:
Whether to reject images that are failing scanning policy evaluation. Images matching a policy assignment without scan results will also be rejected.Evaluation Age:
Whether to reject images when the evaluation is older than X days. You might set this condition to force a new vulnerability check, for example.Unscanned Image:
Whether to reject images that do not have an existing evaluation at admission time. Choose from three options:Ignore:
Ignore this conditionReject:
Reject the requestReject and Scan:
Reject the request and scan the image in parallel.
Typically, Kubernetes will retry creating the pending image, so eventually the image will have a valid evaluation and then the other conditions will apply. Since scanning during admission can potentially slow down the deployment process, we don’t recommend this option unless you are confident that most images will have an evaluation before admission (i.e. instrumenting the CI/CD pipelines).
- Click
Save
.
Understanding: How Policy Conditions are Applied
Policy conditions are applied using an AND
operator.
For example, if I set Evaluation Fail
to Reject
AND Evaluation Age
to Reject for older than 15 days
,
then if I receive an image with an existing evaluation that is passing, and that
evaluation is 20 days old, the request will be rejected.
Assign Controller Policies
Log in as Administrator to Sysdig Secure and select
Image Scanning> Admission Controller|Policy Assignment
.The admission controller policy assignment page displays the list of Kubernetes clusters with Admission Controllers, and their current status.
Connected/disconnected clusters: Clusters where the admission controller was never installed will not appear at all. Otherwise:
Connected:
Clusters with a connected and healthy admission controller will show under the “Connected” label.Disconnected:
A Kubernetes cluster that had an admission controller installed, but the admission controller component is not reporting back to the Sysdig backend, will appear under the “Disconnected” label.
Enabled/disabled Admission Controllers: You enable/ disable the admission controller for each cluster using the switch on the top right.
Enabled:
A green dot by the cluster name shows the admission controller is enabled (enforcing)Disabled:
A grey dot means the admission controller is disabled.
Click
+Add Assignment
and enter the basic assignment details.A cluster can have multiple assignments at different levels of granularity, and the policies are evaluated from top to bottom.
Namespace
: Leave blank to match any namespace, or add a regular expression to match the namespace
ex.:field value matches dev
any namespace containing ‘dev’ ^dev
any namespace starting with ‘dev’ ^dev$
a namespace with the exact name ‘dev’ Prefix:
Leave blank to match any image name, or limit by entering a particular prefix. For example, theredis
prefix would match images declared asredis:latest
orredis:v2
in the container creation request.Policy:
Select a policy from the drop-down list.
Choose
Default policy if no other assignment matches
: Select toAllow
by default orReject
by default.
Be very careful with the Reject by default
option. Be sure to
explicitly allow critical workloads in your system.
- Click
Save
.
Saved changes are pulled from the Admission Controller every 5 minutes
- Optional: Drag the new assignment to a different position in the evaluation list if it should be applied before another assignment.
Understanding: Evaluation Order
Assignments are evaluated from top to bottom. The first match dictates which policy will be applied.
The default cluster action will be applied if no assignment matches.
For example:
Given following assignments:
The policies that apply would be the following
kube-system
namespace, container with image pathdocker.io/myimage
-> will applyPolicy1
mynamespace
namespace, container with image pathquay.io/myimage
-> will applyPolicy2
mynamespace
namespace, container with image pathdocker.io/myimage
-> will apply default policyRejected
Enable/Disable Image Scanning
It is recommended to develop the policies and assignments while the
Admission Controller is Disabled
. Enable on a staging cluster to test
before enabling in production.
When you are happy with the defined behavior:
Log in as Administrator to Sysdig Secure and select
Image Scanning> Admission Controller|Policy Assignment.
Select the relevant cluster from the left side menu.
Slide the Admission Controller to
Enabled
.Monitor any resulting events as usual.
The Disable
function can also be used to quickly stop the Admission
Controller if unexpected behavior is detected that adversely affects the
function of a cluster.
AC Kubernetes Logging - Usage Steps
When Installing the Admission Controller, ensure value
features.k8sAuditDetections
is set totrue
(default value)Create policies of the Kubernetes Audit Policy type.
Check the Events UI for entries.
More Information
- More up-to-date, technical AC - Confirm Working Status.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.