{"id":409374,"date":"2024-06-29T20:45:31","date_gmt":"2024-06-29T20:45:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=409374"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=409374","title":{"rendered":"<span>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f CrowdSec \u0432 Kubernetes<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><em>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u2014 \u0441\u0430\u043c\u0430\u044f \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u0430\u044f \u0443\u0433\u0440\u043e\u0437\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes (K8s), \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u0430\u0436\u0434\u043e\u0435 \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0434\u043b\u044f \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0430\u0442\u0430\u043a\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u043b\u043e\u0433\u0438, \u0430 \u043d\u0430\u0448\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 CrowdSec \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435. \u0417\u043d\u0430\u0447\u0438\u0442, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 K8s \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u0442\u0430\u043a\u0438 \u043d\u0430 \u043d\u0438\u0445. <\/em><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/673\/03c\/048\/67303c0480cf01a4ce994feb04841fe5.png\" alt=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 CrowdSec \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043e\u0431 \u0430\u0442\u0430\u043a\u0430\u0445. \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a (\u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435): CrowdSec\" title=\"\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 CrowdSec \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043e\u0431 \u0430\u0442\u0430\u043a\u0430\u0445. \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a (\u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435): CrowdSec\" width=\"905\" height=\"481\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/673\/03c\/048\/67303c0480cf01a4ce994feb04841fe5.png\"\/><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 CrowdSec \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043e\u0431 \u0430\u0442\u0430\u043a\u0430\u0445. \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a (\u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435): CrowdSec<\/figcaption><\/figure>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435 <\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043c\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0443\u0447\u0451\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c Amazon Web Services (AWS) \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0442\u0440\u043e\u043a\u0438 <a href=\"https:\/\/eksctl.io\/introduction\/\">eksctl<\/a> \u0438\u043b\u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 K8s (\u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0438\u00a01\u00a0\u0413\u0411\u00a0\u041e\u0417\u0423);<\/p>\n<\/li>\n<li>\n<p>\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 <a href=\"https:\/\/kubernetes.io\/docs\/tasks\/tools\/#kubectl\">kubectl<\/a>;<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 <a href=\"https:\/\/helm.sh\/docs\/intro\/install\/\">helm<\/a>.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f <\/h3>\n<p><strong>\u0420\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 K8s<\/strong><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Amazon EKS. \u0412\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f 1 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 t2.small:<\/p>\n<pre><code>apiVersion: eksctl.io\/v1alpha5 kind: ClusterConfig  metadata:   name: alpaga   region: eu-west-1   version: \"1.21\"  nodeGroups:   - name: ng-1     instanceType: t2.small     desiredCapacity: 1     ssh:     allow: true<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0437\u043b\u043e\u0432, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 desiredCapacity.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430:<\/p>\n<pre><code>$ eksctl create cluster -f cluster.yaml 2021-09-17 17:39:41 [] eksctl version 0.62.0 2021-09-17 17:39:41 [] using region eu-west-1 2021-09-17 17:39:41 [] setting availability zones to [eu-west-1a eu-west-1c eu-west-1b] 2021-09-17 17:39:41 [] subnets for eu-west-1a - public:192.168.0.0\/19 private:192.168.96.0\/19 2021-09-17 17:39:41 [] subnets for eu-west-1c - public:192.168.32.0\/19 private:192.168.128.0\/19 2021-09-17 17:39:41 [] subnets for eu-west-1b - public:192.168.64.0\/19 private:192.168.160.0\/19 2021-09-17 17:39:41 [] nodegroup \"ng-1\" will use \"ami-044dfe22e0788d8ed\" [AmazonLinux2\/1.21] 2021-09-17 17:39:41 [] using SSH public key \"\/home\/.ssh\/id_rsa.pub\" as \"eksctl-alpaga-nodegroup-ng-1-7f:94:de:2d:82:df:52:b1:e1:56:4b:a6:7f:2e:91:72\" 2021-09-17 17:39:42 [] using Kubernetes version 1.21  2021-09-17 17:39:42 [] creating EKS cluster \"alpaga\" in \"eu-west-1\" region with un-managed nodes 2021-09-17 17:39:42 [] 1 nodegroup (ng-1) was included (based on the include\/exclude rules) 2021-09-17 17:39:42 [] will create a CloudFormation stack for cluster itself and 1 nodegroup stack(s)  ... 2021-09-17 18:00:57 [] nodegroup \"ng-1\" has 0 node(s) 2021-09-17 18:00:57 [] waiting for at least 1 node(s) to become ready in \"ng-1\" 2021-09-17 18:01:49 [] nodegroup \"ng-1\" has 1 node(s) 2021-09-17 18:01:49 [] node \"ip-192-168-68-125.eu-west-1.compute.internal\" is ready 2021-09-17 18:03:51 [] kubectl command should work with \"\/home\/.kube\/config\", try 'kubectl get nodes' 2021-09-17 18:03:51 [] EKS cluster \"alpaga\" in \"eu-west-1\" region is ready <\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043c\u044b \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<pre><code>$ kubectl cluster-info  Kubernetes control plane is running at https:\/\/XXXXXXXXXXXXXXXXXXXXXXXXXXXX.gr7.eu-west-1.eks.amazonaws.com CoreDNS is running at https:\/\/XXXXXXXXXXXXXXXXXXXXXXXXXXXX.gr7.eu-west-1.eks.amazonaws.com\/api\/v1\/namespaces\/kube-system\/services\/kube-dns:dns\/proxy <\/code><\/pre>\n<h2>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 Nginx Ingress Controller<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 <a href=\"https:\/\/kubernetes.github.io\/ingress-nginx\/deploy\/#aws\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a> \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>kubectl apply -f https:\/\/raw.githubusercontent.com\/kubernetes\/ingress-nginx\/controller-v1.0.0\/deploy\/static\/provider\/aws\/deploy.yaml<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0434\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d:<\/p>\n<pre><code>$ kubectl -n ingress-nginx get pods NAME READY STATUS RESTARTS AGE ingress-nginx-admission-create-psc5c 0\/1 Completed 0 78s ingress-nginx-admission-patch-9qgrr 0\/1 Completed 1 77s ingress-nginx-controller-fd7bb8d66-llxc9 1\/1 Running 0 79s<\/code><\/pre>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f HelloWorld<\/h2>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c HelloWorld, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 Nginx. \u042d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c <a href=\"https:\/\/github.com\/crowdsecurity\/helm-charts\"><u>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/u><\/a>. \u0421\u043f\u0435\u0440\u0432\u0430 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 helm, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 HelloWorld, \u0430 \u0437\u0430\u0442\u0435\u043c CrowdSec:<\/p>\n<pre><code>$ helm repo add crowdsec https:\/\/crowdsecurity.github.io\/helm-charts  \"crowdsec\" has been added to your repositories<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b.<\/p>\n<pre><code>$ helm repo update  Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the \"crowdsec\" chart repository ...Successfully got an update from the \"stable\" chart repository Update Complete. \u2388Happy Helming!\u2388<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 HelloWorld \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0451\u043d, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code>$ helm install helloworld crowdsec\/helloworld  W0920 12:22:22.434028 298463 warnings.go:70] networking.k8s.io\/v1beta1 Ingress is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io\/v1 Ingress W0920 12:22:22.792661 298463 warnings.go:70] networking.k8s.io\/v1beta1 Ingress is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io\/v1 Ingress NAME: helloworld LAST DEPLOYED: Mon Sep 20 12:22:21 2021 NAMESPACE: default STATUS: deployed REVISION: 1 NOTES: 1. Get the application URL by running these commands: http:\/\/helloworld.local\/<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u0442\u043e\u043c\u0443 URL-\u0430\u0434\u0440\u0435\u0441\u0443, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 IP-\u0430\u0434\u0440\u0435\u0441 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432\u0430\u0448\u0435\u0433\u043e \u0445\u043e\u0441\u0442\u0430:<\/p>\n<pre><code>$ kubectl get ingresses.networking.k8s.io  NAME CLASS HOSTS ADDRESS PORTS AGE helloworld &lt;none> helloworld.local a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com 80 2m18s $ host a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com has address 52.31.225.95 a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com has address 54.73.240.30 a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com has address 176.34.92.134 <\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 EKS AWS \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0445\u043e\u0441\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432:<\/p>\n<pre><code>echo \"52.31.225.95 helloworld.local\" | sudo tee -a \/etc\/hosts<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e:<\/p>\n<pre><code>$ curl -v http:\/\/helloworld.local  * Trying 52.31.225.95:80... * TCP_NODELAY set * Connected to helloworld.local (52.31.225.95) port 80 (#0) > GET \/ HTTP\/1.1 > Host: helloworld.local > User-Agent: curl\/7.68.0 > Accept: *\/* > * Mark bundle as not supporting multiuse &lt; HTTP\/1.1 200 OK &lt; Date: Mon, 20 Sep 2021 10:38:21 GMT &lt; Content-Type: text\/plain; charset=utf-8 &lt; Content-Length: 13 &lt; Connection: keep-alive &lt; X-App-Name: http-echo &lt; X-App-Version: 0.2.3 &lt; helloworld! * Connection #0 to host helloworld.local left intact<\/code><\/pre>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043b\u043e\u0433\u0438 Nginx, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043b\u043e\u0433 HTTP:<\/p>\n<pre><code>$ k -n ingress-nginx logs ingress-nginx-controller-fd7bb8d66-llxc9 82.125.X.X - - [20\/Sep\/2021:10:38:21 +0000] \"GET \/ HTTP\/1.1\" 200 13 \"-\" \"curl\/7.68.0\" 80 0.001 [default-helloworld-5678] [] 192.168.65.115:5678 13 0.000 200 abb8f358776224ff5c14a6c0a227b450 <\/code><\/pre>\n<p>\u041d\u0430\u0448\u0430 \u0441\u0440\u0435\u0434\u0430 \u0433\u043e\u0442\u043e\u0432\u0430!<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 CrowdSec<\/h3>\n<p>\u041f\u0430\u043a\u0435\u0442 CrowdSec \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u043d\u0430\u0448\u0435\u043c <a href=\"https:\/\/github.com\/crowdsecurity\/helm-charts\"><u>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/u><\/a> \u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/p>\n<p>\u0421\u043f\u0435\u0440\u0432\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0451\u043d:<\/p>\n<pre><code>$ kubectl create ns crowdsec namespace\/crowdsec created<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u043b\u043e\u0433\u0438 Nginx, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u0448\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441\u00a0\u044d\u0442\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c. \u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 CrowdSec \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b crowdsec-values.yaml:<\/p>\n<pre><code>agent:   # To specify each pod you want to process it logs (pods present in the node)   acquisition:     # The namespace where the pod is located     - namespace: ingress-nginx       # The pod name       podName: ingress-nginx-controller-*       # as in crowdsec configuration, we need to specify the program name so the parser will match and parse logs       program: Nginx   # Those are ENV variables   env:   # As it's a test, we don't want to share signals with CrowdSec so disable the Online API.   - name: DISABLE_ONLINE_API     value: \"true\"   # As we are running Nginx, we want to install the Nginx collection   - name: COLLECTIONS     value: \"crowdsecurity\/nginx\" lapi:   env:     # As it's a test, we don't want to share signals with CrowdSec, so disable the Online API.     - name: DISABLE_ONLINE_API       value: \"true\"<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b \u043e\u0431\u0440\u0430\u0437\u0430 Docker, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0434\u0430\u043d\u043d\u044b\u043c <a href=\"https:\/\/hub.docker.com\/r\/crowdsecurity\/crowdsec\"><u>\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c<\/u><\/a>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c CrowdSec, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d CrowdSec, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435:<\/p>\n<pre><code>$ helm install crowdsec crowdsec\/crowdsec -f crowdsec-values.yaml -n crowdsec  NAME: crowdsec LAST DEPLOYED: Mon Sep 20 17:46:02 2021 NAMESPACE: crowdsec STATUS: deployed REVISION: 1 TEST SUITE: None<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u0430\u0433\u0435\u043d\u0442 \u0438 LAPI (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 API CrowdSec) \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b:<\/p>\n<pre><code>$ k get pods -n crowdsec  NAME READY STATUS RESTARTS AGE crowdsec-agent-kf9fr 1\/1 Running 0 34s crowdsec-lapi-777c469947-jbk9q 1\/1 Running 0 34s<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043b\u0438 CrowdSec \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u0442\u0430\u043a\u0438, \u043c\u044b \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u043c \u0430\u0442\u0430\u043a\u0443 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 HelloWorld \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043a\u0430\u043d\u0435\u0440\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0430\u0442\u0430\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 Nikto (\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0430\u0442\u0430\u043a\u0443 \u0438 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u0435 \u0435\u0435 \u0447\u0435\u0440\u0435\u0437 20 \u0441\u0435\u043a\u0443\u043d\u0434, \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438 \u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0442\u0430\u043a\u0430\u0445 \u043d\u0430\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435):<\/p>\n<pre><code>$ .\/nikto.pl -host http:\/\/helloworld.local<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c shell \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 \u0430\u0433\u0435\u043d\u0442\u0430 CrowdSec \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u0438 \u0430\u0442\u0430\u043a\u0438:<\/p>\n<pre><code>$ kubectl -n crowdsec exec -it crowdsec-agent-vn4bp -- sh  \/ # cscli metrics INFO[21-09-2021 09:39:50 AM] Buckets Metrics:                              +-------------------------------------------+---------------+-----------+--------------+--------+---------+ |                  BUCKET                   | CURRENT COUNT | OVERFLOWS | INSTANCIATED | POURED | EXPIRED | +-------------------------------------------+---------------+-----------+--------------+--------+---------+ | crowdsecurity\/http-bad-user-agent         |             3 |       183 |          186 |    369 | -       | | crowdsecurity\/http-crawl-non_statics      | -             |         7 |            9 |    351 |       2 | | crowdsecurity\/http-path-traversal-probing | -             | -         |            1 |      2 |       1 | | crowdsecurity\/http-probing                |             1 | -         |            2 |      2 |       1 | | crowdsecurity\/http-sensitive-files        | -             |         3 |            4 |     17 |       1 | +-------------------------------------------+---------------+-----------+--------------+--------+---------+ INFO[21-09-2021 09:39:50 AM] Acquisition Metrics:                          +-----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+--------------+----------------+------------------------+ |                                                                             SOURCE                                                                              | LINES READ | LINES PARSED | LINES UNPARSED | LINES POURED TO BUCKET | +-----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+--------------+----------------+------------------------+ | file:\/var\/log\/containers\/ingress-nginx-controller-fd7bb8d66-llxc9_ingress-nginx_controller-c536915796f13bbf66d1a8ab7159dbd055773dbbf89ab4d9653043591dfaef1f.log |        371 |          371 | -              |                    741 | +-----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+--------------+----------------+------------------------+ INFO[21-09-2021 09:39:50 AM] Parser Metrics:                               +--------------------------------+------+--------+----------+ |            PARSERS             | HITS | PARSED | UNPARSED | +--------------------------------+------+--------+----------+ | child-crowdsecurity\/http-logs  | 1113 |    738 |      375 | | child-crowdsecurity\/nginx-logs |  371 |    371 | -        | | crowdsecurity\/dateparse-enrich |  371 |    371 | -        | | crowdsecurity\/docker-logs      |  371 |    371 | -        | | crowdsecurity\/geoip-enrich     |  371 |    371 | -        | | crowdsecurity\/http-logs        |  371 |    360 |       11 | | crowdsecurity\/nginx-logs       |  371 |    371 | -        | | crowdsecurity\/whitelists       |  371 |    371 | -        | +--------------------------------+------+--------+----------+ <\/code><\/pre>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0444\u0430\u0439\u043b\u044b, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 CrowdSec (\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445), \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445\/\u043d\u0435\u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0438 \u0432\u0441\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0442\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u043e\u0432. \u0412 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u043c\u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 Crowdsecurity\/Nginx \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f HTTP-\u0430\u0442\u0430\u043a.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043b\u0438 \u0430\u0433\u0435\u043d\u0442 CrowdSec \u0430\u0442\u0430\u043a\u0438 \u043e\u0442 Nikto:<\/p>\n<pre><code>\/ # cscli alerts list  +----+------------------+--------------------------------------+---------+---------+-----------+--------------------------------+ | ID |      VALUE       |                REASON                | COUNTRY |   AS    | DECISIONS |           CREATED AT           | +----+------------------+--------------------------------------+---------+---------+-----------+--------------------------------+ |  3 | Ip:82.125.X.X    | crowdsecurity\/http-sensitive-files   | FR      |  Orange | ban:1     | 2021-09-21 09:38:12.624461519  | |    |                  |                                      |         |         |           | +0000 UTC                      | |  2 | Ip:82.125.X.X    | crowdsecurity\/http-crawl-non_statics | FR      |  Orange | ban:1     | 2021-09-21 09:38:12.104034837  | |    |                  |                                      |         |         |           | +0000 UTC                      | |  1 | Ip:82.125.X.X    | crowdsecurity\/http-bad-user-agent    | FR      |  Orange | ban:1     | 2021-09-21 09:38:12.104018425  | |    |                  |                                      |         |         |           | +0000 UTC                      | +----+------------------+--------------------------------------+---------+---------+-----------+--------------------------------+ <\/code><\/pre>\n<p>\u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0433\u0435\u043d\u0442\u043e\u043c CrowdSec \u043f\u043e\u0441\u043b\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Nikto. \u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u0438 \u0430\u0433\u0435\u043d\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e \u0431\u0430\u043d\u0435 \u0432 LAPI. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u044d\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0431\u0430\u0443\u043d\u0441\u0435\u0440\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u043e\u0442 IP.<\/p>\n<h3>&#171;\u041f\u0440\u0438\u0431\u0438\u0440\u0430\u0435\u043c&#187; \u0437\u0430 \u0441\u043e\u0431\u043e\u0439<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043d\u0430\u0448\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:<\/p>\n<p>\u2014 \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438\u00a0eksctl:<\/p>\n<pre><code>eksctl delete cluster -f cluster.yaml<\/code><\/pre>\n<p>\u2014 \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432 \u043d\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438:<\/p>\n<pre><code>$ helm delete crowdsec -n crowdsec $ helm delete helloworld<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 Nginx, \u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>kubectl delete -f https:\/\/raw.githubusercontent.com\/kubernetes\/ingress-nginx\/controller-v1.0.0\/deploy\/static\/provider\/aws\/deploy.yaml<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <\/h2>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 CrowdSec \u0432 Kubernetes \u0438 \u0442\u043e, \u043a\u0430\u043a \u043d\u0430\u0448\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u0442\u0430\u043a\u0438. \u041d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u044b \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0430\u0442\u0430\u043a. \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430\u0434 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435\u043c \u0431\u0430\u0443\u043d\u0441\u0435\u0440\u043e\u0432 \u0432 Kubernetes \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0430\u0442\u0430\u043a. \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 <a href=\"https:\/\/github.com\/crowdsecurity\/lua-cs-bouncer\"><u>Lua<\/u><\/a> \u0432 Nginx \u0438 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u043e\u0441\u0442\u0435, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0443\u043d\u0441\u0435\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442\u00a0\u0430\u0442\u0430\u043a.<\/p>\n<p>\u041d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u044d\u0442\u043e\u0442 \u043e\u0431\u0437\u043e\u0440. \u0411\u0443\u0434\u0435\u043c \u0440\u0430\u0434\u044b \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c \u0432\u0430\u0448\u0435 \u043c\u043d\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f CrowdSec \u0432 Kubernetes.\u00a0<\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <a href=\"https:\/\/crowdsec.net\/\"><u>CrowdSec<\/u><\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/592305\/\"> https:\/\/habr.com\/ru\/articles\/592305\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><em>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u2014 \u0441\u0430\u043c\u0430\u044f \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u0430\u044f \u0443\u0433\u0440\u043e\u0437\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes (K8s), \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u0430\u0436\u0434\u043e\u0435 \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0434\u043b\u044f \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u043e\u0432 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0430\u0442\u0430\u043a\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u043b\u043e\u0433\u0438, \u0430 \u043d\u0430\u0448\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 CrowdSec \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435. \u0417\u043d\u0430\u0447\u0438\u0442, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 K8s \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u0442\u0430\u043a\u0438 \u043d\u0430 \u043d\u0438\u0445. <\/em><\/p>\n<figure class=\"full-width\"><figcaption>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 CrowdSec \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043e\u0431 \u0430\u0442\u0430\u043a\u0430\u0445. \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a (\u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435): CrowdSec<\/figcaption><\/figure>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0440\u0430\u0431\u043e\u0442\u0435 <\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043c\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0443\u0447\u0451\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c Amazon Web Services (AWS) \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0442\u0440\u043e\u043a\u0438 <a href=\"https:\/\/eksctl.io\/introduction\/\">eksctl<\/a> \u0438\u043b\u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 K8s (\u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0438\u00a01\u00a0\u0413\u0411\u00a0\u041e\u0417\u0423);<\/p>\n<\/li>\n<li>\n<p>\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 <a href=\"https:\/\/kubernetes.io\/docs\/tasks\/tools\/#kubectl\">kubectl<\/a>;<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 <a href=\"https:\/\/helm.sh\/docs\/intro\/install\/\">helm<\/a>.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f <\/h3>\n<p><strong>\u0420\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 K8s<\/strong><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Amazon EKS. \u0412\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f 1 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 t2.small:<\/p>\n<pre><code>apiVersion: eksctl.io\/v1alpha5 kind: ClusterConfig  metadata:   name: alpaga   region: eu-west-1   version: \"1.21\"  nodeGroups:   - name: ng-1     instanceType: t2.small     desiredCapacity: 1     ssh:     allow: true<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0437\u043b\u043e\u0432, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 desiredCapacity.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430:<\/p>\n<pre><code>$ eksctl create cluster -f cluster.yaml 2021-09-17 17:39:41 [] eksctl version 0.62.0 2021-09-17 17:39:41 [] using region eu-west-1 2021-09-17 17:39:41 [] setting availability zones to [eu-west-1a eu-west-1c eu-west-1b] 2021-09-17 17:39:41 [] subnets for eu-west-1a - public:192.168.0.0\/19 private:192.168.96.0\/19 2021-09-17 17:39:41 [] subnets for eu-west-1c - public:192.168.32.0\/19 private:192.168.128.0\/19 2021-09-17 17:39:41 [] subnets for eu-west-1b - public:192.168.64.0\/19 private:192.168.160.0\/19 2021-09-17 17:39:41 [] nodegroup \"ng-1\" will use \"ami-044dfe22e0788d8ed\" [AmazonLinux2\/1.21] 2021-09-17 17:39:41 [] using SSH public key \"\/home\/.ssh\/id_rsa.pub\" as \"eksctl-alpaga-nodegroup-ng-1-7f:94:de:2d:82:df:52:b1:e1:56:4b:a6:7f:2e:91:72\" 2021-09-17 17:39:42 [] using Kubernetes version 1.21  2021-09-17 17:39:42 [] creating EKS cluster \"alpaga\" in \"eu-west-1\" region with un-managed nodes 2021-09-17 17:39:42 [] 1 nodegroup (ng-1) was included (based on the include\/exclude rules) 2021-09-17 17:39:42 [] will create a CloudFormation stack for cluster itself and 1 nodegroup stack(s)  ... 2021-09-17 18:00:57 [] nodegroup \"ng-1\" has 0 node(s) 2021-09-17 18:00:57 [] waiting for at least 1 node(s) to become ready in \"ng-1\" 2021-09-17 18:01:49 [] nodegroup \"ng-1\" has 1 node(s) 2021-09-17 18:01:49 [] node \"ip-192-168-68-125.eu-west-1.compute.internal\" is ready 2021-09-17 18:03:51 [] kubectl command should work with \"\/home\/.kube\/config\", try 'kubectl get nodes' 2021-09-17 18:03:51 [] EKS cluster \"alpaga\" in \"eu-west-1\" region is ready <\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043c\u044b \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<pre><code>$ kubectl cluster-info  Kubernetes control plane is running at https:\/\/XXXXXXXXXXXXXXXXXXXXXXXXXXXX.gr7.eu-west-1.eks.amazonaws.com CoreDNS is running at https:\/\/XXXXXXXXXXXXXXXXXXXXXXXXXXXX.gr7.eu-west-1.eks.amazonaws.com\/api\/v1\/namespaces\/kube-system\/services\/kube-dns:dns\/proxy <\/code><\/pre>\n<h2>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 Nginx Ingress Controller<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 <a href=\"https:\/\/kubernetes.github.io\/ingress-nginx\/deploy\/#aws\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a> \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>kubectl apply -f https:\/\/raw.githubusercontent.com\/kubernetes\/ingress-nginx\/controller-v1.0.0\/deploy\/static\/provider\/aws\/deploy.yaml<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0434\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d:<\/p>\n<pre><code>$ kubectl -n ingress-nginx get pods NAME READY STATUS RESTARTS AGE ingress-nginx-admission-create-psc5c 0\/1 Completed 0 78s ingress-nginx-admission-patch-9qgrr 0\/1 Completed 1 77s ingress-nginx-controller-fd7bb8d66-llxc9 1\/1 Running 0 79s<\/code><\/pre>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f HelloWorld<\/h2>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c HelloWorld, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 Nginx. \u042d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c <a href=\"https:\/\/github.com\/crowdsecurity\/helm-charts\"><u>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/u><\/a>. \u0421\u043f\u0435\u0440\u0432\u0430 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 helm, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 HelloWorld, \u0430 \u0437\u0430\u0442\u0435\u043c CrowdSec:<\/p>\n<pre><code>$ helm repo add crowdsec https:\/\/crowdsecurity.github.io\/helm-charts  \"crowdsec\" has been added to your repositories<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b.<\/p>\n<pre><code>$ helm repo update  Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the \"crowdsec\" chart repository ...Successfully got an update from the \"stable\" chart repository Update Complete. \u2388Happy Helming!\u2388<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 HelloWorld \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0451\u043d, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code>$ helm install helloworld crowdsec\/helloworld  W0920 12:22:22.434028 298463 warnings.go:70] networking.k8s.io\/v1beta1 Ingress is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io\/v1 Ingress W0920 12:22:22.792661 298463 warnings.go:70] networking.k8s.io\/v1beta1 Ingress is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io\/v1 Ingress NAME: helloworld LAST DEPLOYED: Mon Sep 20 12:22:21 2021 NAMESPACE: default STATUS: deployed REVISION: 1 NOTES: 1. Get the application URL by running these commands: http:\/\/helloworld.local\/<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u0442\u043e\u043c\u0443 URL-\u0430\u0434\u0440\u0435\u0441\u0443, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 IP-\u0430\u0434\u0440\u0435\u0441 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432\u0430\u0448\u0435\u0433\u043e \u0445\u043e\u0441\u0442\u0430:<\/p>\n<pre><code>$ kubectl get ingresses.networking.k8s.io  NAME CLASS HOSTS ADDRESS PORTS AGE helloworld &lt;none> helloworld.local a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com 80 2m18s $ host a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com has address 52.31.225.95 a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com has address 54.73.240.30 a8523ec3bb4024bc3a7f8b26294013f3-c7ea4e370eaf1195.elb.eu-west-1.amazonaws.com has address 176.34.92.134 <\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 EKS AWS \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0445\u043e\u0441\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432:<\/p>\n<pre><code>echo \"52.31.225.95 helloworld.local\" | sudo tee -a \/etc\/hosts<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e:<\/p>\n<pre><code>$ curl -v http:\/\/helloworld.local  * Trying 52.31.225.95:80... * TCP_NODELAY set * Connected to helloworld.local (52.31.225.95) port 80 (#0) > GET \/ HTTP\/1.1 > Host: helloworld.local > User-Agent: curl\/7.68.0 > Accept: *\/* > * Mark bundle as not supporting multiuse &lt; HTTP\/1.1 200 OK &lt; Date: Mon, 20 Sep 2021 10:38:21 GMT &lt; Content-Type: text\/plain; charset=utf-8 &lt; Content-Length: 13 &lt; Connection: keep-alive &lt; X-App-Name: http-echo &lt; X-App-Version: 0.2.3 &lt; helloworld! * Connection #0 to host helloworld.local left intact<\/code><\/pre>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043b\u043e\u0433\u0438 Nginx, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043b\u043e\u0433 HTTP:<\/p>\n<pre><code>$ k -n ingress-nginx logs ingress-nginx-controller-fd7bb8d66-llxc9 82.125.X.X - - [20\/Sep\/2021:10:38:21 +0000] \"GET \/ HTTP\/1.1\" 200 13 \"-\" \"curl\/7.68.0\" 80 0.001 [default-helloworld-5678] [] 192.168.65.115:5678 13 0.000 200 abb8f358776224ff5c14a6c0a227b450 <\/code><\/pre>\n<p>\u041d\u0430\u0448\u0430 \u0441\u0440\u0435\u0434\u0430 \u0433\u043e\u0442\u043e\u0432\u0430!<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 CrowdSec<\/h3>\n<p>\u041f\u0430\u043a\u0435\u0442 CrowdSec \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u043d\u0430\u0448\u0435\u043c <a href=\"https:\/\/github.com\/crowdsecurity\/helm-charts\"><u>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/u><\/a> \u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/p>\n<p>\u0421\u043f\u0435\u0440\u0432\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0451\u043d:<\/p>\n<pre><code>$ kubectl create ns crowdsec namespace\/crowdsec created<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u043b\u043e\u0433\u0438 Nginx, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u0448\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441\u00a0\u044d\u0442\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c. \u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 CrowdSec \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b crowdsec-values.yaml:<\/p>\n<pre><code>agent:   # To specify each pod you want to process it logs (pods present in the node)   acquisition:     # The namespace where the pod is located     - namespace: ingress-nginx       # The pod name       podName: ingress-nginx-controller-*       # as in crowdsec configuration, we need to specify the program name so the parser will match and parse logs       program: Nginx   # Those are ENV variables   env:   # As it's a test, we don't want to share signals with CrowdSec so disable the Online API.   - name: DISABLE_ONLINE_API     value: \"true\"   # As we are running Nginx, we want to install the Nginx collection   - name: COLLECTIONS     value: \"crowdsecurity\/nginx\" lapi:   env:     # As it's a test, we don't want to share signals with CrowdSec, so disable the Online API.     - name: DISABLE_ONLINE_API       value: \"true\"<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b \u043e\u0431\u0440\u0430\u0437\u0430 Docker, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0434\u0430\u043d\u043d\u044b\u043c <a href=\"https:\/\/hub.docker.com\/r\/crowdsecurity\/crowdsec\"><u>\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c<\/u><\/a>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c CrowdSec, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d CrowdSec, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435:<\/p>\n<pre><code>$ helm install crowdsec crowdsec\/crowdsec -f crowdsec-values.yaml -n crowdsec  NAME: crowdsec LAST DEPLOYED: Mon Sep 20 17:46:02 2021 NAMESPACE: crowdsec STATUS: deployed REVISION: 1 TEST SUITE: None<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u0430\u0433\u0435\u043d\u0442 \u0438 LAPI (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 API CrowdSec) \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b:<\/p>\n<pre><code>$ k get pods -n crowdsec  NAME READY STATUS RESTARTS AGE crowdsec-agent-kf9fr 1\/1 Running 0 34s crowdsec-lapi-777c469947-jbk9q 1\/1 Running 0 34s<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043b\u0438 CrowdSec \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u0442\u0430\u043a\u0438, \u043c\u044b \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u043c \u0430\u0442\u0430\u043a\u0443 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 HelloWorld \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043a\u0430\u043d\u0435\u0440\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0430\u0442\u0430\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 Nikto (\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0430\u0442\u0430\u043a\u0443 \u0438 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u0435 \u0435\u0435 \u0447\u0435\u0440\u0435\u0437 20 \u0441\u0435\u043a\u0443\u043d\u0434, \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438 \u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0442\u0430\u043a\u0430\u0445 \u043d\u0430\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435):<\/p>\n<pre><code>$ .\/nikto.pl -host http:\/\/helloworld.local<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c shell \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 \u0430\u0433\u0435\u043d\u0442\u0430 CrowdSec \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u0438 \u0430\u0442\u0430\u043a\u0438:<\/p>\n<pre><code>$ kubectl -n crowdsec exec -it crowdsec-agent-vn4bp -- sh  \/ # cscli metrics INFO[21-09-2021 09:39:50 AM] Buckets Metrics:                              +-------------------------------------------+---------------+-----------+--------------+--------+---------+ |                  BUCKET                   | CURRENT COUNT | OVERFLOWS | INSTANCIATED | POURED | EXPIRED | +-------------------------------------------+---------------+-----------+--------------+--------+---------+ |<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-409374","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/409374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=409374"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/409374\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=409374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=409374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=409374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}