惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
月光博客
月光博客
F
Fortinet All Blogs
Stack Overflow Blog
Stack Overflow Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
博客园 - 司徒正美
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
博客园_首页
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
L
LangChain Blog
博客园 - 聂微东
G
Google Developers Blog
博客园 - Franky

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Automate Kubernetes Image Vulnerability Scanning
josepraveen · 2026-05-30 · via DEV Community

josepraveen

Security in a cloud-native environment is only as strong as its weakest link. A recent security audit revealed a critical gap: container images were being deployed to our cluster with outdated software versions harboring numerous vulnerabilities.

To solve this, we are implementing an ImagePolicyWebhook. By configuring an Admission Controller to point to a webhook backend image scanner, we can intercept deployment requests and reject any image that doesn't meet our security standards.


The Solution

In this walkthrough, we will configure the Kubernetes API server to communicate with an existing scanner (like Trivy) via a webhook.

1. Configure the Admission Controller

First, we need to define the configuration for the ImagePolicyWebhook plugin. This file tells Kubernetes where to find the backend credentials and how to behave if the scanner is unreachable.

Edit the configuration file:

sudo vi /etc/kubernetes/admission-control/admission-control.conf

Paste the following configuration:

apiVersion: apiserver.config.k8s.io/v1
kind: AdmissionConfiguration
plugins:
- name: ImagePolicyWebhook
  configuration:
    imagePolicy:
      kubeConfigFile: /etc/kubernetes/admission-control/imagepolicy_backend.kubeconfig
      allowTTL: 50
      denyTTL: 50
      retryBackoff: 500
      defaultAllow: false # Fails closed for security

changes

Pro Tip: Setting defaultAllow: false ensures that if the scanner is down, no unverified images are allowed into the cluster.


2. Point the Kubeconfig to the Backend Webhook

The Admission Controller needs a kubeconfig file to know the endpoint of the scanning service.

Edit the kubeconfig:

sudo vi /etc/kubernetes/admission-control/imagepolicy_backend.kubeconfig

Update the server endpoint:
Locate the server line under the cluster section and set it to:

server: https://acg.trivy.k8s.webhook:8090/scan

trivy


3. Enable the Admission Control Plugin

Now, we must tell the Kubernetes API server to actually use the plugin we just configured.

Edit the kube-apiserver manifest:

sudo vi /etc/kubernetes/manifests/kube-apiserver.yaml

Update the flags:
Scroll down to the --enable-admission-plugins section and add ImagePolicyWebhook:

--enable-admission-plugins=NodeRestriction,ImagePolicyWebhook


changes

Once you save this file, the API server will automatically restart to apply the changes.


Testing the Implementation

The "Good" Pod

Create a Pod using an image that is known to be clean:

kubectl create -f good-pod.yml

Result: The Pod should be created successfully.

The "Bad" Pod

Now, attempt to deploy an image with known vulnerabilities:

kubectl create -f bad-pod.yml

error

Result: The creation will fail! You will receive an error message indicating that the image was rejected by the ImagePolicyWebhook due to security vulnerabilities.

Conclusion

By shifting security to the Admission Control phase, you ensure that no vulnerable code ever reaches your production nodes. Automation like this turns "security" from a manual checklist into an unbreakable gatekeeper.

Happy (and secure) Kube-ing! 🛡️ ☸️