{"id":291400,"date":"2018-10-26T11:55:02","date_gmt":"2018-10-26T07:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=291400"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2018-10-26T07:55:02","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=291400","title":{"rendered":"Kubernetes tips &#038; tricks: \u0434\u043e\u0441\u0442\u0443\u043f \u043a dev-\u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0430\u043c"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0432 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Kubernetes. \u0412\u0441\u0435 \u043e\u043d\u0438 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u043f\u044b\u0442\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0438 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0430\u043b\u0438\u0441\u044c, \u043d\u043e \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e\u0442 \u043d\u0430 \u0438\u0434\u0435\u0430\u043b \u2014 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0439\u0442\u0435 \u0438\u0445 \u0441\u043a\u043e\u0440\u0435\u0435 \u043a\u0430\u043a \u0438\u0434\u0435\u0438 \u0438 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0438, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0439\u0442\u0435 \u0441\u0432\u043e\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jx\/ht\/jr\/jxhtjry3qmixqrb-_968gbd_qs4.jpeg\"><\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0434\u0432\u0435 \u0442\u0435\u043c\u044b, \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043e\u0434\u043d\u043e\u0439 \u0442\u0435\u043c\u043e\u0439: \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043a dev-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044e.<a name=\"habracut\"><\/a><\/p>\n<h2>1. \u041a\u0430\u043a \u043c\u044b \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c dev-\u043a\u043e\u043d\u0442\u0443\u0440\u044b \u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439?<\/h2>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0437\u0430 basic auth \u0438\u043b\u0438 \u0437\u0430 \u0431\u0435\u043b\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0432\u0435\u0441\u044c dev-\u043a\u043e\u043d\u0442\u0443\u0440 (\u0434\u0435\u0441\u044f\u0442\u043a\u0438\/\u0441\u043e\u0442\u043d\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439), \u0434\u0430\u0431\u044b \u0442\u0443\u0434\u0430 \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0431\u043e\u0442\u044b \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u043b\u044e\u0434\u0438.<\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 Ingress \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/kubernetes\/contrib\/tree\/master\/ingress\/controllers\/nginx\/examples\/auth\">\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u043a\u0440\u0435\u0442\u044b basic auth<\/a>. \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043c\u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441 \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430\u043c\u0438.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d nginx \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430:<\/p>\n<pre><code class=\"nginx\">location \/ {   satisfy any;    auth_basic \"Authentication or whitelist!\";   auth_basic_user_file \/etc\/nginx\/htpasswd\/htpasswd;    allow 10.0.0.0\/8;   allow 175.28.12.2\/32;   deny  all;    try_files FAKE_NON_EXISTENT @return200; }  location @return200 {   return 200 Ok; }<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 Ingress&#8217;\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e: <\/p>\n<p>  <code>ingress.kubernetes.io\/auth-url: \"http:\/\/dev-auth.dev-auth-infra.svc.cluster.local\"<\/code><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 <code>dev-auth<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0432\u0432\u0435\u0434\u0435\u043d \u043b\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 basic auth \u0438\u043b\u0438 \u0436\u0435 \u043a\u043b\u0438\u0435\u043d\u0442 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 whitelist. \u0415\u0441\u043b\u0438 \u043e\u0434\u043d\u043e \u0438\u0437 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e, \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zl\/oi\/-r\/zloi-rlzrfp935uovi5762b3qk4.png\"><\/p>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u0432 \u0438 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u00ab\u0435\u0434\u0438\u043d\u044b\u0439 \u0446\u0435\u043d\u0442\u0440 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438\u00bb. \u0415\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438.<\/p>\n<h2>2. \u041a\u0430\u043a \u043c\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c \u0432\u043d\u0443\u0442\u0440\u0438 Kubernetes \u0432 dev-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438?<\/h2>\n<p>  <i>\u2026 \u0431\u0443\u0434\u044c \u0442\u043e Redis, RabbitMQ, PostgreSQL \u0438\u043b\u0438 \u043b\u044e\u0431\u0438\u043c\u044b\u0439 PHP-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 Xdebug.<\/i><\/p>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Kubernetes, \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043b\u0443\u0447\u0448\u0435\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u0438 \u0432\u043e\u0432\u0441\u0435. \u0418 \u0442\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u00ab\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u0432\u043e\u0435\u0439 IDE\u00bb \u0432 \u0431\u0430\u0437\u0443 \u0438\u043b\u0438 \u0432 Xdebug, \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u044e\u0442 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438. <\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c VPN \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes. \u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a VPN-\u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0432 K8s, \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 OpenVPN \u043c\u044b push&#8217;\u0438\u043c \u0430\u0434\u0440\u0435\u0441 DNS-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u0436\u0435 \u0436\u0438\u0432\u0451\u0442 \u0432 K8s. OpenVPN \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442 VPN \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 Kubernetes \u043e\u043d \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 DNS-\u0441\u0435\u0440\u0432\u0435\u0440 Kubernetes \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430 \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <code>redis.production.svc.cluster.local<\/code>. DNS \u0432 Kubernetes \u0440\u0435\u0437\u043e\u043b\u0432\u0438\u0442 \u0435\u0433\u043e \u0432 \u0430\u0434\u0440\u0435\u0441 10.244.1.15 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u044d\u0442\u043e\u0442 IP-\u0430\u0434\u0440\u0435\u0441 \u0438\u0434\u0443\u0442 \u0447\u0435\u0440\u0435\u0437 OpenVPN \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kubernetes.<\/p>\n<p>  \u0417\u0430 \u0432\u0440\u0435\u043c\u044f \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043c\u044b \u0443\u0441\u043f\u0435\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ol>\n<li> \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e\u0439 (\u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f) <b>\u0430\u0434\u043c\u0438\u043d\u043a\u0438 \u0434\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u0432 \u043a VPN<\/b>, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u2014 \u0432\u0435\u0434\u044c <a href=\"https:\/\/github.com\/helm\/charts\/tree\/master\/stable\/openvpn\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0447\u0430\u0440\u0442<\/a> \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0434\u043b\u044f \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432.\n<p>  <a href=\"https:\/\/github.com\/vitaliy-sn\/openvpn-easyrsa-web-ui\/tree\/dev\">\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0430\u0434\u043c\u0438\u043d\u043a\u0430<\/a> (\u0441\u043c. \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 <a href=\"https:\/\/hub.docker.com\/r\/ixdx\/openvpn-easyrsa-web-ui\/\">Docker Hub<\/a>) \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u0430\u0441\u043a\u0435\u0442\u0438\u0447\u043d\u043e:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jh\/3t\/yx\/jh3tyxlld0gkfuj3xqsx6zqurto.png\"><\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0445 \u044e\u0437\u0435\u0440\u043e\u0432 \u0438\u043b\u0438 \u043e\u0442\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/j6\/ck\/8l\/j6ck8labsqw82jyacqzr9pylivk.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430: <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xy\/ka\/yo\/xykayonukrklnh8tdp_p3-hyd40.png\">  <\/li>\n<li> \u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 <b>\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0432 VPN&#8217;\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044e\u0437\u0435\u0440\u043e\u0432 \u0432 GitLab<\/b>, \u0433\u0434\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u0430\u043a\u0442\u0438\u0432\u0435\u043d \u043b\u0438 \u044e\u0437\u0435\u0440 \u0432 GitLab. \u042d\u0442\u043e \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u044e\u0437\u0435\u0440\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a dev VPN \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 GitLab&#8217;\u0430, \u0438 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u0434\u043c\u0438\u043d\u043e\u043a \u2014 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u00abSSO \u0434\u043b\u044f \u0431\u0435\u0434\u043d\u044b\u0445\u00bb. \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0431\u0440\u0430\u043b\u0438 \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 <a href=\"https:\/\/github.com\/helm\/charts\/tree\/master\/stable\/openvpn\">\u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0447\u0430\u0440\u0442<\/a>.\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 Python-\u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u044e\u0437\u0435\u0440\u0430 \u043a OpenVPN, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0445\u044d\u0448 \u0432 \u0431\u0430\u0437\u0435 GitLab \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0435\u0433\u043e \u0441\u0442\u0430\u0442\u0443\u0441 (\u0430\u043a\u0442\u0438\u0432\u0435\u043d \u043b\u0438 \u043e\u043d).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/eb\/s6\/gg\/ebs6ggujgreuw3szeqaebnadpgm.png\"><\/p>\n<p>  \u0412\u043e\u0442 \u0441\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3  # pip3 install psycopg2-binary bcrypt  import bcrypt import sys import os import psycopg2 import yaml  with open(\"\/etc\/openvpn\/setup\/config.yaml\", 'r') as ymlfile:     cfg = yaml.load(ymlfile)  def get_user_info(username=''):     try:         connect_str = \"dbname=%s user=%s host=%s password=%s\" % (cfg['db'], cfg['user'], cfg['host'], cfg['pass'])         # use our connection values to establish a connection         conn = psycopg2.connect(connect_str)         # create a psycopg2 cursor that can execute queries         cursor = conn.cursor()         # create a new table with a single column called \"name\"         cursor.execute(\"\"\"SELECT encrypted_password,state FROM users WHERE username='%s';\"\"\" % username)         # run a SELECT statement - no data in there, but we can try it         rows = cursor.fetchall()         print(rows)         return(rows[0])     except Exception as e:         print(\"Uh oh, can't connect. Invalid dbname, user or password?\")         print(e)  def check_user_auth():     username = os.environ['username']     password = bytes(os.environ['password'], 'utf-8')     # hashed = bcrypt.hashpw(password, bcrypt.gensalt())      user_info = get_user_info(username=username)     user_encrypted_password = bytes(user_info[0], 'utf-8')     user_state = True if user_info[1] == 'active' else False      if bcrypt.checkpw(password, user_encrypted_password) and user_state:         print(\"It matches!\")         sys.exit(0)     else:         print(\"It does not match :(\")         sys.exit(1)  def main():     check_user_auth()  if __name__ == '__main__':     main()<\/code><\/pre>\n<p>  \u0410 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 OpenVPN \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <code> auth-user-pass-verify \/etc\/openvpn\/auth-user.py via-env<br \/>   script-security 3<br \/>   client-cert-not-required<\/code><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0443\u0432\u043e\u043b\u044c\u043d\u044f\u043b\u0441\u044f \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a, \u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0432 GitLab, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u043d \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0438 \u043a VPN&#8217;\u0443.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h2>\n<p>  \u0412 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 \u0441\u0442\u0430\u0442\u0435\u0439 \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u0430\u043c\u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u00ab\u0424\u043b\u0430\u043d\u0442\u00bb \u043f\u043e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 Kubernetes \u044f \u0440\u0430\u0441\u043a\u0440\u043e\u044e \u0442\u0430\u043a\u0438\u0435 \u0442\u0435\u043c\u044b, \u043a\u0430\u043a \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0443\u0437\u043b\u043e\u0432 \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 (\u0437\u0430\u0447\u0435\u043c \u0438 \u043a\u0430\u043a?) \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0434 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043b\u0443\u0436\u0431 \u0432\u0440\u043e\u0434\u0435 php-fpm\/gunicorn, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043d\u0430\u0448 \u0431\u043b\u043e\u0433, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f!<\/p>\n<h2>P.S.<\/h2>\n<p>   \u0414\u0440\u0443\u0433\u043e\u0435 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 K8s tips &amp; tricks:<\/p>\n<ul>\n<li> \u00ab<a href=\"https:\/\/habr.com\/company\/flant\/blog\/417509\/\">\u0423\u0441\u043a\u043e\u0440\u044f\u0435\u043c bootstrap \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445<\/a>\u00bb.<\/li>\n<\/ul>\n<p>  \u0427\u0438\u0442\u0430\u0439\u0442\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u0431\u043b\u043e\u0433\u0435:<\/p>\n<ul>\n<li> \u00ab<a href=\"https:\/\/habr.com\/company\/flant\/blog\/417905\/\">11 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 (\u043d\u0435) \u0441\u0442\u0430\u0442\u044c \u0436\u0435\u0440\u0442\u0432\u043e\u0439 \u0432\u0437\u043b\u043e\u043c\u0430 \u0432 Kubernetes<\/a>\u00bb;<\/li>\n<li> \u00ab<a href=\"https:\/\/habr.com\/company\/flant\/blog\/345580\/\">\u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0434e\u043f\u043b\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 Kubernetes \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e dapp \u0438 GitLab CI<\/a>\u00bb;<\/li>\n<li> \u00ab<a href=\"https:\/\/habr.com\/company\/flant\/blog\/412901\/\">\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 Kubernetes<\/a>\u00bb <i>(\u043e\u0431\u0437\u043e\u0440 \u0438 \u0432\u0438\u0434\u0435\u043e \u0434\u043e\u043a\u043b\u0430\u0434\u0430)<\/i>;<\/li>\n<li> \u00ab<a href=\"https:\/\/habr.com\/company\/flant\/blog\/331188\/\">\u041d\u0430\u0448 \u043e\u043f\u044b\u0442 \u0441 Kubernetes \u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445<\/a>\u00bb <i>(\u0432\u0438\u0434\u0435\u043e \u0434\u043e\u043a\u043b\u0430\u0434\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0432 \u0441\u0435\u0431\u044f \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c Kubernetes)<\/i>.<\/li>\n<\/ul>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/company\/flant\/blog\/427745\/\"> https:\/\/habr.com\/company\/flant\/blog\/427745\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0432 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 Kubernetes. \u0412\u0441\u0435 \u043e\u043d\u0438 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u043f\u044b\u0442\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0438 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0430\u043b\u0438\u0441\u044c, \u043d\u043e \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e\u0442 \u043d\u0430 \u0438\u0434\u0435\u0430\u043b \u2014 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0439\u0442\u0435 \u0438\u0445 \u0441\u043a\u043e\u0440\u0435\u0435 \u043a\u0430\u043a \u0438\u0434\u0435\u0438 \u0438 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0438, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0439\u0442\u0435 \u0441\u0432\u043e\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jx\/ht\/jr\/jxhtjry3qmixqrb-_968gbd_qs4.jpeg\"><\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0434\u0432\u0435 \u0442\u0435\u043c\u044b, \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043e\u0434\u043d\u043e\u0439 \u0442\u0435\u043c\u043e\u0439: \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043a dev-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044e.<\/p>\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-291400","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291400","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=291400"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291400\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}