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

推荐订阅源

S
Securelist
V
V2EX
MongoDB | Blog
MongoDB | Blog
量子位
J
Java Code Geeks
GbyAI
GbyAI
Attack and Defense Labs
Attack and Defense Labs
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 叶小钗
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Cloudbric
Cloudbric
Recorded Future
Recorded Future
月光博客
月光博客
Help Net Security
Help Net Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
The Register - Security
The Register - Security
Scott Helme
Scott Helme
Google DeepMind News
Google DeepMind News
W
WeLiveSecurity
G
Google Developers Blog
T
Troy Hunt's Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
I
InfoQ
S
SegmentFault 最新的问题
G
GRAHAM CLULEY
C
Check Point Blog
Project Zero
Project Zero
有赞技术团队
有赞技术团队
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
P
Privacy International News Feed
AI
AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Full Disclosure
C
CXSECURITY Database RSS Feed - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Hacker News: Front Page
S
Secure Thoughts
罗磊的独立博客
T
Threat Research - Cisco Blogs
aimingoo的专栏
aimingoo的专栏
博客园_首页
宝玉的分享
宝玉的分享
C
Cybersecurity and Infrastructure Security Agency CISA

Explugins on CoreDNS: DNS and Service Discovery

redis_cache docker kubeforward JSON gslb fanout k8s_cache gathersrv meship meshname multicluster recursor redis finalize kubenodes ebpf rrl mysql warnlist git alternate k8s_dns_chaos records k8s_gateway netbox mdns wgsd alias lighthouse ens idetcd gravwell amazondns kubernetai redisc unbound on dump pdsql ipin ipecho demo example
k8s_event
2022-08-23 · via Explugins on CoreDNS: DNS and Service Discovery

Description

k8s_event listens for log printings, and reports them as Events to Kubernetes APIServer.

This plugin requires …

  • the kubeapi plugin to create a connection to the Kubernetes API.
  • create/patch/update permission to the Events API.

Enabling this plugin is process-wide: enabling k8s_event in at least one server block enables it globally.

Syntax

k8s_event {
    level LEVELS...
    rate [QPS] [Burst] [CacheSize]
}
  • levels selects what level of logs should be reported as Kubernetes events. LEVELS is a space-separated list of log levels, supported levels are debug, error, fatal, info, and warning. The level of the log will be reflected on the Reason field of event, e.g. it will use CoreDNSWarning as Reason field for a warning log. If no level is specified, it defaults to error and warning.
  • rate is used to control the throttling of events.
    • QPS is the fill rate of the token bucket in queries per second, which is 1/300 by default.
    • Burst is the burst size used by the token bucket rate filtering, which is 25 by default.
    • CacheSize is the lru cache size used for event caching locally, which is 4096 by default.

Deployment

By default, this plugin reports events on behalf of its own CoreDNS Pod, PodName and Namespace are collected through the Downward API.

When deploying CoreDNS in kubernetes, you should include the following environment variables.

env:
  - name: COREDNS_POD_NAME
    valueFrom:
      fieldRef:
        fieldPath: metadata.name
  - name: COREDNS_NAMESPACE
    valueFrom:
      fieldRef:
        fieldPath: metadata.namespace

When these environment variables are missing, this plugin reports events on behalf of the default namespace.

Also, the system:coredns ClusterRole should be appended with following.

- apiGroups:
  - ""
  - events.k8s.io
  resources:
  - events
  verbs:
  - create
  - patch
  - update

Example

Listens for log printings of info, error, and warning levels, and reports them via in-cluster Kubernetes API. The event sending rate is controlled by QPS 0.15 token/sec, Burst 10 tokens, and LRUCacheSize 1024 tokens.

.:53 {
    kubeapi
    k8s_event {
      level info error warning
      rate 0.15 10 1024
    }
}

Outputs

$ kubectl get ev -A -w
NAMESPACE   LAST SEEN   TYPE      REASON           OBJECT              MESSAGE
default     1s          Normal    CoreDNSInfo      namespace/default   plugin/reload: Running configuration SHA512 = <omitted>
default     1s          Warning   CoreDNSError     namespace/default   plugin/errors: 2 <omitted>. A: read udp <omitted>: i/o timeout
default     1s          Warning   CoreDNSError     namespace/default   plugin/reload: Corefile changed but reload failed: <omitted>