{"id":330498,"date":"2022-03-10T15:01:30","date_gmt":"2022-03-10T15:01:30","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=330498"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=330498","title":{"rendered":"<span>\u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c PostgreSQL, Redis \u0438 RabbitMQ \u0432 Kubernetes-\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e11\/5d2\/558\/e115d2558170195ee68c9d527834a5cf.png\" width=\"2007\" height=\"1363\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e11\/5d2\/558\/e115d2558170195ee68c9d527834a5cf.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c, \u0437\u0430\u0447\u0435\u043c \u0432\u043e\u0442 \u044d\u0442\u043e \u0432\u0441\u0451 \u043d\u0443\u0436\u043d\u043e, \u0438\u043b\u0438 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0439\u0442\u0435 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u043a\u0430\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e (\u0437\u0430\u043c\u0435\u0442\u043a\u0443) \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0432 dev-\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes. <\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<ol>\n<li>\n<p><a href=\"#0\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#1\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 PostgreSQL<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#2\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Redis<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#3\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 RabbitMQ<\/a><\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<p><a class=\"anchor\" name=\"0\" id=\"0\"><\/a><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 PostgresSQL, Redis \u0438 RabbitMQ \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438 \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430. \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0440\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <code>Persistent Volume<\/code> (PV) \u0438 <code>Persistent Volume Claim<\/code> (PVC).<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 <code>Helm<\/code>-\u0447\u0430\u0440\u0442\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<\/li>\n<\/ul>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PV \u0438 PVC. \u0415\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f <a href=\"https:\/\/www.youtube.com\/watch?v=8Wk1iI8mMrw&amp;ab_channel=%D0%A1%D0%BB%D1%91%D1%80%D0%BC\">\u043b\u0435\u043a\u0446\u0438\u044f<\/a> \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043c\u0435\u043b\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043c\u043e\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442 \u043d\u0443\u0436\u043d\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kubernetes. \u0412\u043e\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0412\u0435\u0440\u0441\u0438\u044f Kubernetes 1.20+.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0434\u043d\u0430 master-\u043d\u043e\u0434\u0430 \u0438 \u043e\u0434\u043d\u0430 worker-\u043d\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 Ingress-controller.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442 \u043d\u0430 bare-metal, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c MetalLB \u0438\u043b\u0438 PorterLB.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Helm.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043b\u0430\u043c\u043f\u043e\u0432\u044b\u0439 dev-\u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043d\u0430 \u0433\u043e\u043b\u043e\u043c \u0436\u0435\u043b\u0435\u0437\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432 <a href=\"https:\/\/habr.com\/ru\/company\/domclick\/blog\/577964\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439<\/a> \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 PostgreSQL<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441 <code>StorageClass<\/code>, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0444\u0430\u0439\u043b storage.yaml \u0432\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"yaml\">kind: StorageClass apiVersion: storage.k8s.io\/v1 metadata:   name: local-storage provisioner: kubernetes.io\/no-provisioner volumeBindingMode: WaitForFirstConsumer<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/84c\/5ef\/f30\/84c5eff304037fa52b0b2cc1af890d4c.png\" width=\"956\" height=\"76\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/84c\/5ef\/f30\/84c5eff304037fa52b0b2cc1af890d4c.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441 <code>Persistent Volume<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0444\u0430\u0439\u043b pv.yaml \u0432\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442:<\/p>\n<pre><code class=\"yaml\">apiVersion: v1 kind: PersistentVolume metadata:   name: pv-for-pg   labels:     type: local spec:   capacity:     storage: 4Gi   volumeMode: Filesystem   accessModes:   - ReadWriteOnce   persistentVolumeReclaimPolicy: Retain   storageClassName: local-storage   local:     path: \/devkube\/postgresql   nodeAffinity:     required:       nodeSelectorTerms:       - matchExpressions:         - key: kubernetes.io\/hostname           operator: In           values:           - 457344.cloud4box.ru<\/code><\/pre>\n<p>\u0412 <code>matchExpressions<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0434\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0438\u0441\u043a. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0443\u0437\u043b\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">kubectl get nodes<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c57\/eeb\/a75\/c57eeba752dbea21b0e13ea24cfea570.png\" width=\"1478\" height=\"150\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c57\/eeb\/a75\/c57eeba752dbea21b0e13ea24cfea570.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0431\u0443\u0434\u0435\u043c \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0441\u043a \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u043c\u0430\u0441\u0442\u0435\u0440-\u043d\u043e\u0434\u0435, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435. \u041c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/devkube\/postgresql. \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">mkdir -p \/devkube\/postgresql<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441 <code>Persistent Volume<\/code>:<\/p>\n<pre><code class=\"bash\">kubectl apply -f pv.yaml<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a5d\/2eb\/b80\/a5d2ebb80a2308b8219e2cfbe35aaa72.png\" width=\"952\" height=\"78\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a5d\/2eb\/b80\/a5d2ebb80a2308b8219e2cfbe35aaa72.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">kubectl get pv<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7c0\/f0c\/e93\/7c0f0ce9355ad010ceb1d1af48debbd1.png\" width=\"1718\" height=\"112\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7c0\/f0c\/e93\/7c0f0ce9355ad010ceb1d1af48debbd1.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0441 <code>Persistent Volume Claim<\/code>:<\/p>\n<pre><code class=\"yaml\">kind: PersistentVolumeClaim apiVersion: v1 metadata:   name: pg-pvc spec:   storageClassName: \"local-storage\"   accessModes:   - ReadWriteOnce   resources:     requests:       storage: 4Gi<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b02\/5ca\/8f3\/b025ca8f32df0b275cca8a1d867ce77d.png\" width=\"824\" height=\"72\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b02\/5ca\/8f3\/b025ca8f32df0b275cca8a1d867ce77d.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/478\/354\/2e4\/4783542e49668e0ecf8feac783ee758c.png\" width=\"1274\" height=\"110\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/478\/354\/2e4\/4783542e49668e0ecf8feac783ee758c.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0441\u0443\u0440\u0441 <code>PVC<\/code> \u0432 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c Postgres \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435. \u041f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u043a \u0441\u0435\u0431\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 Bitnami:<\/p>\n<pre><code class=\"bash\">helm repo add bitnami https:\/\/charts.bitnami.com\/bitnami<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/445\/0c4\/861\/4450c4861535420de4b6e5c2dac656d3.png\" width=\"1260\" height=\"84\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/445\/0c4\/861\/4450c4861535420de4b6e5c2dac656d3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0430\u0440\u0442 Helm \u0441 Postgres:<\/p>\n<pre><code class=\"bash\">helm install dev-pg bitnami\/postgresql --set primary.persistence.existingClaim=pg-pvc,auth.postgresPassword=pgpass<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <code>PVC<\/code>:<\/p>\n<pre><code>kubectl get pvc<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/493\/196\/29a\/49319629acd61a257b4f39a0f67505ed.png\" width=\"1412\" height=\"120\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/493\/196\/29a\/49319629acd61a257b4f39a0f67505ed.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0441\u0443\u0440\u0441 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 <code>bound<\/code>, \u0442\u0435\u043f\u0435\u0440\u044c pod \u0441 Postgres \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/devkube\/postgresql. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <code>pod, statefulset<\/code>:<\/p>\n<pre><code>kubectl get pod,statefulset<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d56\/c3a\/864\/d56c3a864eb3e96f404e6bd63bd255f9.png\" width=\"1430\" height=\"372\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d56\/c3a\/864\/d56c3a864eb3e96f404e6bd63bd255f9.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0411\u0430\u0437\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u0439: \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u044b. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0447\u0430\u0440\u0442\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0411\u0414. \u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>1. \u041f\u0440\u043e\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u0440\u0442 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 psql. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430:<\/p>\n<pre><code class=\"bash\">psql -V<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b27\/82a\/86f\/b2782a86f3553b9849be33c1d0efaeb5.png\" width=\"516\" height=\"80\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b27\/82a\/86f\/b2782a86f3553b9849be33c1d0efaeb5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u0430\u0434\u043c\u0438\u043d-\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">export POSTGRES_PASSWORD=$(kubectl get secret --namespace default dev-pg-postgresql -o jsonpath=\"{.data.postgres-password}\" | base64 --decode)<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u0430:<\/p>\n<pre><code>kubectl port-forward --namespace default svc\/dev-pg-postgresql 5432:5432<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/682\/0c1\/316\/6820c1316864815aef18ae39d9d23b92.png\" width=\"1502\" height=\"116\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/682\/0c1\/316\/6820c1316864815aef18ae39d9d23b92.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430. \u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u043e\u043a\u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a \u044d\u0442\u043e\u0439 \u0436\u0435 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0411\u0414:<\/p>\n<pre><code class=\"bash\">PGPASSWORD=\"$POSTGRES_PASSWORD\" psql --host 127.0.0.1 -U postgres -d postgres -p 5432<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u0442\u0430\u043a, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e:<\/p>\n<pre><code class=\"bash\">psql --host 127.0.0.1 -U postgres -d postgres -p 5432<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d3c\/015\/933\/d3c015933f660bcda4ea514d65d8e813.png\" width=\"1246\" height=\"302\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d3c\/015\/933\/d3c015933f660bcda4ea514d65d8e813.png\"\/><figcaption><\/figcaption><\/figure>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>2. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0434\u0443 \u0441 psql \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<p>\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u0430\u0434\u043c\u0438\u043d-\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"pgsql\">export POSTGRES_PASSWORD=$(kubectl get secret --namespace default dev-pg-postgresql -o jsonpath=\"{.data.postgres-password}\" | base64 --decode)<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u0434 \u0441 \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 psql \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432 \u043d\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0411\u0414:<\/p>\n<pre><code class=\"pgsql\">kubectl run dev-pg-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io\/bitnami\/postgresql:14.2.0-debian-10-r22 --env=\"PGPASSWORD=$POSTGRES_PASSWORD\" \\       --command -- psql --host dev-pg-postgresql -U postgres -d postgres -p 5432<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/df2\/1b1\/397\/df21b13978a56c4d5f0efbdfc9124ef9.png\" width=\"2458\" height=\"188\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/df2\/1b1\/397\/df21b13978a56c4d5f0efbdfc9124ef9.png\"\/><figcaption><\/figcaption><\/figure>\n<\/div>\n<\/details>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u043e\u043b\u044c (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f) \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043d\u0435\u0451:<\/p>\n<pre><code class=\"pgsql\">CREATE ROLE qa_user WITH LOGIN ENCRYPTED PASSWORD 'qa-pg-pass';<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1f2\/919\/ebd\/1f2919ebd931424ea4d7fa220cbde337.png\" width=\"1230\" height=\"80\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1f2\/919\/ebd\/1f2919ebd931424ea4d7fa220cbde337.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u043e\u043b\u0435\u0439:<\/p>\n<pre><code class=\"pgsql\">\\du<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7e4\/154\/69b\/7e415469b9f118ae4c397ca7d7162332.png\" width=\"1416\" height=\"248\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7e4\/154\/69b\/7e415469b9f118ae4c397ca7d7162332.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0431\u0430\u0437\u0443, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c qa_user:<\/p>\n<pre><code class=\"pgsql\">CREATE DATABASE qa_db OWNER qa_user;<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/da2\/adf\/3be\/da2adf3bef03c30c8e5dbdb57caed46b.png\" width=\"810\" height=\"76\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/da2\/adf\/3be\/da2adf3bef03c30c8e5dbdb57caed46b.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f:<\/p>\n<pre><code class=\"pgsql\">\\q<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u0432\u0442\u043e\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c):<\/p>\n<pre><code class=\"bash\">kubectl run dev-pg-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io\/bitnami\/postgresql:14.2.0-debian-10-r22 --env=\"PGPASSWORD=qa-pg-pass\"  --command -- psql --host dev-pg-postgresql -U qa_user -d qa_db -p 5432<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0fc\/eff\/e49\/0fceffe49919c742f576388413c8432e.png\" width=\"2464\" height=\"186\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0fc\/eff\/e49\/0fceffe49919c742f576388413c8432e.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443:<\/p>\n<pre><code class=\"pgsql\">CREATE TABLE qa_table (id int, name varchar(255));<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b60\/c5b\/d59\/b60c5bd595272681140e1733d5b5030f.png\" width=\"966\" height=\"78\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b60\/c5b\/d59\/b60c5bd595272681140e1733d5b5030f.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u044c:<\/p>\n<pre><code class=\"pgsql\">INSERT INTO qa_table VALUES (1, 'first');<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c5e\/47d\/750\/c5e47d750252e840c9a664e097f0d7d2.png\" width=\"860\" height=\"78\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c5e\/47d\/750\/c5e47d750252e840c9a664e097f0d7d2.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c <code>select<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"pgsql\">SELECT * FROM qa_table;<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/738\/015\/122\/73801512288d6bf92e1f909bd52562a3.png\" width=\"1024\" height=\"198\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/738\/015\/122\/73801512288d6bf92e1f909bd52562a3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u0431\u0430\u0437\u0435:<\/p>\n<pre><code class=\"pgsql\">\\dt+<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9bd\/366\/f1c\/9bd366f1c34b7e7edceefebb5553ab29.png\" width=\"1632\" height=\"236\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9bd\/366\/f1c\/9bd366f1c34b7e7edceefebb5553ab29.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e, \u0431\u0430\u0437\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u0430! \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0430\u0434\u0440\u0435\u0441 \u0411\u0414:<\/p>\n<pre><code>DATABASE_URI=postgresql:\/\/qa_user:qa-pg-pass@dev-pg-postgresql:5432\/qa_db<\/code><\/pre>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Redis<\/h2>\n<p>Redis \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 <a href=\"https:\/\/github.com\/bitnami\/charts\/tree\/master\/bitnami\/redis#introduction\">\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445<\/a>. \u041c\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0434\u0432\u0443\u043c\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u043c\u0438 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u043e\u0434\u043d\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u043e\u0439 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0431\u0430\u0437\u0443. \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0441\u043e <code>StorageClass<\/code>:<\/p>\n<pre><code class=\"yaml\">kind: StorageClass apiVersion: storage.k8s.io\/v1 metadata:   name: local-storage provisioner: kubernetes.io\/no-provisioner volumeBindingMode: WaitForFirstConsumer<\/code><\/pre>\n<pre><code class=\"yaml\">kubectl apply -f storage.yaml<\/code><\/pre>\n<p>\u0423 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0431\u044b\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u044d\u0442\u043e\u0442 \u0440\u0435\u0441\u0443\u0440\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0441\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/954\/753\/08b\/95475308b53841a56fcb7dbaa8cafa41.png\" width=\"1028\" height=\"72\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/954\/753\/08b\/95475308b53841a56fcb7dbaa8cafa41.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c <code>Persistent Volumes<\/code>. \u0417\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u0435\u043c 2 \u0413\u0431 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 slave-\u0440\u0435\u043f\u043b\u0438\u043a\u0438 \u0438 4 \u0413\u0431 \u0434\u043b\u044f \u043c\u0430\u0441\u0442\u0435\u0440-\u0440\u0435\u043f\u043b\u0438\u043a\u0438. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b\u044b pv-slave1.yaml, pv-slave2.yaml \u0438 pv-master.yaml \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u043d\u0438\u0445 \u044d\u0442\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"yaml\">apiVersion: v1 kind: PersistentVolume metadata:   name: pv-redis-slave1   labels:     type: local spec:   capacity:     storage: 2Gi   volumeMode: Filesystem   accessModes:   - ReadWriteOnce   persistentVolumeReclaimPolicy: Retain   storageClassName: local-storage   local:     path: \/devkube\/redis\/slave1   nodeAffinity:     required:       nodeSelectorTerms:       - matchExpressions:         - key: kubernetes.io\/hostname           operator: In           values:           - 457344.cloud4box.ru<\/code><\/pre>\n<pre><code class=\"yaml\">apiVersion: v1 kind: PersistentVolume metadata:   name: pv-redis-slave2   labels:     type: local spec:   capacity:     storage: 2Gi   volumeMode: Filesystem   accessModes:   - ReadWriteOnce   persistentVolumeReclaimPolicy: Retain   storageClassName: local-storage   local:     path: \/devkube\/redis\/slave2   nodeAffinity:     required:       nodeSelectorTerms:       - matchExpressions:         - key: kubernetes.io\/hostname           operator: In           values:           - 457344.cloud4box.ru<\/code><\/pre>\n<pre><code class=\"yaml\">apiVersion: v1 kind: PersistentVolume metadata:   name: pv-redis-master   labels:     type: local spec:   capacity:     storage: 4Gi   volumeMode: Filesystem   accessModes:   - ReadWriteOnce   persistentVolumeReclaimPolicy: Retain   storageClassName: local-storage   local:     path: \/devkube\/redis\/master   nodeAffinity:     required:       nodeSelectorTerms:       - matchExpressions:         - key: kubernetes.io\/hostname           operator: In           values:           - 457344.cloud4box.ru<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0440\u0435\u043f\u043b\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043d\u043e\u0434\u0435 457344.cloud4box.ru, \u0445\u043e\u0442\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0441\u043a\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0440\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438:<\/p>\n<pre><code class=\"bash\">mkdir -p \/devkube\/redis\/slave1 mkdir -p \/devkube\/redis\/slave2 mkdir -p \/devkube\/redis\/master<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">kubectl apply -f .<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/49f\/0c6\/015\/49f0c6015e3aac3909e8268a336b3743.png\" width=\"1028\" height=\"146\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/49f\/0c6\/015\/49f0c6015e3aac3909e8268a336b3743.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<pre><code class=\"bash\">kubectl get pv<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/19b\/b5f\/ba1\/19bb5fba181a9797989559e3a3b07025.png\" width=\"2072\" height=\"218\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/19b\/b5f\/ba1\/19bb5fba181a9797989559e3a3b07025.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 <code>PV<\/code> \u0435\u0449\u0451 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b \u0438 \u0436\u0434\u0443\u0442 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u0410 <code>Persistent Volumes Postgres<\/code> \u0443\u0436\u0435 \u0441\u0432\u044f\u0437\u0430\u043d \u0441\u043e \u0441\u0432\u043e\u0438\u043c <code>Persistent Volumes \u0421laim<\/code> (\u0442\u0430\u043a \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f Postgres-\u0431\u0430\u0437\u044b \u0432 Kubernetes).<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <code>PVC<\/code> \u0434\u043b\u044f \u043c\u0430\u0441\u0442\u0435\u0440-\u0440\u0435\u043f\u043b\u0438\u043a\u0438. \u0418\u0445 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u0442\u043e\u043c namespace, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u0442\u0435 \u0431\u0430\u0437\u0443. Redis \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 dev-redis. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e:<\/p>\n<pre><code class=\"bash\">kubectl create ns dev-redis<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b61\/330\/1fd\/b613301fd9e2bda75a419016bb535cac.png\" width=\"900\" height=\"76\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b61\/330\/1fd\/b613301fd9e2bda75a419016bb535cac.png\"\/><figcaption><\/figcaption><\/figure>\n<pre><code class=\"bash\">kind: PersistentVolumeClaim apiVersion: v1 metadata:   name: pvc-for-master-redis   namespace: dev-redis spec:   storageClassName: \"local-storage\"   accessModes:   - ReadWriteOnce   resources:     requests:       storage: 4Gi<\/code><\/pre>\n<pre><code>kubectl apply -f pvc-master.yaml<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/51b\/ec3\/0f5\/51bec30f5a70ae9739458cb45ef056fc.png\" width=\"964\" height=\"68\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/51b\/ec3\/0f5\/51bec30f5a70ae9739458cb45ef056fc.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f slave-\u0440\u0435\u043f\u043b\u0438\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c <code>PVC<\/code> \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0447\u0430\u0440\u0442\u0430 Helm.<\/p>\n<p>\u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Redis. \u041f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u043a \u0441\u0435\u0431\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 Bitnami, \u0435\u0441\u043b\u0438 \u0435\u0449\u0451 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 (\u0443 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d):<\/p>\n<pre><code>helm repo add bitnami https:\/\/charts.bitnami.com\/bitnami<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ef3\/db1\/c2e\/ef3db1c2e469f607d1fe7aa1e83c05b0.png\" width=\"1392\" height=\"76\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ef3\/db1\/c2e\/ef3db1c2e469f607d1fe7aa1e83c05b0.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0430\u0440\u0442 Helm \u0441 Redis:<\/p>\n<pre><code class=\"bash\">helm install dev-redis-chart bitnami\/redis --namespace dev-redis --set global.redis.password=redispass,master.persistence.existingClaim=pvc-for-master-redis,replica.replicaCount=2,replica.persistence.storageClass=local-storage,replica.persistence.size=2Gi<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e:<\/p>\n<ul>\n<li>\n<p><code>password=redispass<\/code> \u2014 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p><code>existingClaim=pvc-for-master-redis<\/code> \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 <code>PVC<\/code> \u0434\u043b\u044f \u043c\u0430\u0441\u0442\u0435\u0440-\u0440\u0435\u043f\u043b\u0438\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p><code>replicaCount, storageClass, size<\/code> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e slave-\u0440\u0435\u043f\u043b\u0438\u043a, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <code>StorageClass<\/code> \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 <code>PV<\/code>. \u042d\u0442\u043e \u0432\u0441\u0451 \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>PVC<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a Redis. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <code>Persistent Volumes<\/code>:<\/p>\n<pre><code>kubectl get pv<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/88b\/c65\/2c3\/88bc652c3d93f932144f140b1b449cb9.png\" width=\"2406\" height=\"220\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/88b\/c65\/2c3\/88bc652c3d93f932144f140b1b449cb9.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0441\u0442\u0430\u043b\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c <code>PVC<\/code>. \u0418 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<pre><code>kubectl get pod,svc,statefulset -n dev-redis<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e9f\/115\/e49\/e9f115e491c7fc6c05dff9994c967e64.png\" width=\"1658\" height=\"510\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e9f\/115\/e49\/e9f115e491c7fc6c05dff9994c967e64.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0441\u0451 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e, \u043f\u043e\u0440\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0438 \u043f\u043e\u043f\u0438\u043d\u0433\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u0443. \u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code>export REDIS_PASSWORD=$(kubectl get secret --namespace dev-redis dev-redis-chart -o jsonpath=\"{.data.redis-password}\" | base64 --decode)<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u0434 \u0441 redis-cli \u043d\u0430 \u0431\u043e\u0440\u0442\u0443:<\/p>\n<pre><code>kubectl run --namespace dev-redis redis-client --restart='Never'  --env REDIS_PASSWORD=$REDIS_PASSWORD  --image docker.io\/bitnami\/redis:6.2.6-debian-10-r146 --command -- sleep infinity<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/228\/ab2\/c7f\/228ab2c7ffa71ef6542d812e21d730dd.png\" width=\"2464\" height=\"112\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/228\/ab2\/c7f\/228ab2c7ffa71ef6542d812e21d730dd.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u0432\u043d\u0443\u0442\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0430:<\/p>\n<pre><code>kubectl exec --tty -i redis-client \\    --namespace dev-redis -- bash<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d08\/2cb\/eba\/d082cbebad44b7a459e1e37d5f204e5c.png\" width=\"1178\" height=\"110\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d08\/2cb\/eba\/d082cbebad44b7a459e1e37d5f204e5c.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a master- \u0438\u043b\u0438 slave-\u0440\u0435\u043f\u043b\u0438\u043a\u0435 \u043d\u0430 \u0432\u044b\u0431\u043e\u0440: <\/p>\n<pre><code>   REDISCLI_AUTH=\"$REDIS_PASSWORD\" redis-cli -h dev-redis-chart-master    \u0438\u043b\u0438    REDISCLI_AUTH=\"$REDIS_PASSWORD\" redis-cli -h dev-redis-chart-replicas<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043a master-\u0440\u0435\u043f\u043b\u0438\u043a\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1bd\/04b\/4eb\/1bd04b4eb5fb35e7ecab1203be8b9ad9.png\" width=\"1672\" height=\"80\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1bd\/04b\/4eb\/1bd04b4eb5fb35e7ecab1203be8b9ad9.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0438\u043d\u0433\u0430\u043d\u0451\u043c \u0431\u0430\u0437\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/11d\/483\/042\/11d483042ef152e21b629849e46f1f51.png\" width=\"706\" height=\"70\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/11d\/483\/042\/11d483042ef152e21b629849e46f1f51.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432 \u043b\u044e\u0431\u0443\u044e \u0438\u0437 15 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0437 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u0430\u0437\u0430 \u043f\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u043d\u043e\u043b\u044c). \u0412\u044b\u0431\u0435\u0440\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0442\u043e\u0440\u0443\u044e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d0b\/b12\/822\/d0bb12822aafe2469ac3ac558f787bf3.png\" width=\"958\" height=\"110\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d0b\/b12\/822\/d0bb12822aafe2469ac3ac558f787bf3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c1c\/f01\/1c5\/c1cf011c595f412d8c3d0625efe92574.png\" width=\"992\" height=\"74\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c1c\/f01\/1c5\/c1cf011c595f412d8c3d0625efe92574.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0438\u0445 \u0436\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/622\/b5c\/034\/622b5c034d3bde9733ef11475344dd2d.png\" width=\"1012\" height=\"72\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/622\/b5c\/034\/622b5c034d3bde9733ef11475344dd2d.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! Redis \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442 \u0438 \u0433\u043e\u0442\u043e\u0432 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e. \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0430\u0434\u0440\u0435\u0441:<\/p>\n<pre><code>REDIS=redis:\/\/redispass@dev-redis-chart-master:6379\/0<\/code><\/pre>\n<p><a class=\"anchor\" name=\"3\" id=\"3\"><\/a><\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 RabbitMQ<\/h2>\n<p>\u0417\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0441 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u043c <code>StorageClass<\/code> \u0432 \u0444\u0430\u0439\u043b storage.yaml:<\/p>\n<pre><code class=\"yaml\">kind: StorageClass apiVersion: storage.k8s.io\/v1 metadata:   name: local-storage provisioner: kubernetes.io\/no-provisioner volumeBindingMode: WaitForFirstConsumer<\/code><\/pre>\n<p>\u0418 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0435\u0433\u043e:<\/p>\n<pre><code class=\"bash\">kubectl apply -f storage.yaml<\/code><\/pre>\n<p>\u0423 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0431\u044b\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u044d\u0442\u043e\u0442 \u0440\u0435\u0441\u0443\u0440\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0441\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b29\/e50\/4a4\/b29e504a43ae7104cae95faf382d09d9.png\" width=\"1002\" height=\"76\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b29\/e50\/4a4\/b29e504a43ae7104cae95faf382d09d9.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <code>Persistent Volume<\/code>:<\/p>\n<pre><code class=\"yaml\">apiVersion: v1 kind: PersistentVolume metadata:   name: pv-for-rmq   labels:     type: local spec:   capacity:     storage: 4Gi   volumeMode: Filesystem   accessModes:   - ReadWriteOnce   persistentVolumeReclaimPolicy: Retain   storageClassName: local-storage   local:     path: \/devkube\/rabbitmq   nodeAffinity:     required:       nodeSelectorTerms:       - matchExpressions:         - key: kubernetes.io\/hostname           operator: In           values:           - 457344.cloud4box.ru<\/code><\/pre>\n<p>\u0412 <code>matchExpressions<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0434\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u043c \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0441\u043a. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0443\u0437\u043b\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>kubectl get nodes<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d1b\/a2d\/4f6\/d1ba2d4f63b9fa4cb5e39582826d1cc6.png\" width=\"1294\" height=\"148\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d1b\/a2d\/4f6\/d1ba2d4f63b9fa4cb5e39582826d1cc6.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0431\u0443\u0434\u0435\u043c \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0441\u043a \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 master-\u043d\u043e\u0434\u0435, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e <code>RabbitMQ<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<pre><code class=\"bash\">mkdir -p \/devkube\/rabbitmq<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441 <code>Persistent Volume<\/code>:<\/p>\n<pre><code>kubectl apply -f pv.yaml<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ebd\/9d1\/6e4\/ebd9d16e45d45ed2855adb1990605ba0.png\" width=\"1006\" height=\"76\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ebd\/9d1\/6e4\/ebd9d16e45d45ed2855adb1990605ba0.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/93d\/b46\/230\/93db462307574e89a6925d6fbdb61b8f.png\" width=\"2472\" height=\"262\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/93d\/b46\/230\/93db462307574e89a6925d6fbdb61b8f.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>Persistent Volume Claim<\/code>. \u0415\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u0442\u043e\u043c namespace, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442\u0435 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0443\u0449\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. RabbitMQ \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 dev-rmq. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0433\u043e:<\/p>\n<pre><code class=\"bash\">kubectl create ns dev-rmq<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0c7\/c41\/411\/0c7c41411a84c79d68a24b8c36f71374.png\" width=\"832\" height=\"76\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0c7\/c41\/411\/0c7c41411a84c79d68a24b8c36f71374.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0432 \u0444\u0430\u0439\u043b pvc.yaml:<\/p>\n<pre><code class=\"yaml\">kind: PersistentVolumeClaim apiVersion: v1 metadata:   name: rmq-pvc   namespace: dev-rmq spec:   storageClassName: \"local-storage\"   accessModes:   - ReadWriteOnce   resources:     requests:       storage: 4Gi<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c:<\/p>\n<pre><code class=\"bash\">kubectl apply -f pvc.yaml<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/188\/ecf\/677\/188ecf677280acffe08efae3bd08458d.png\" width=\"872\" height=\"82\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/188\/ecf\/677\/188ecf677280acffe08efae3bd08458d.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u043c RabbitMQ. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u0441\u0435\u0431\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 Bitnami, \u0435\u0441\u043b\u0438 \u0435\u0449\u0451 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 (\u0443 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d):<\/p>\n<pre><code class=\"bash\">helm repo add bitnami https:\/\/charts.bitnami.com\/bitnami<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fe3\/b74\/b26\/fe3b74b265f5e6819eefff9b43bf4b05.png\" width=\"1340\" height=\"82\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fe3\/b74\/b26\/fe3b74b265f5e6819eefff9b43bf4b05.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0447\u0430\u0440\u0442 Helm RabbitMQ:<\/p>\n<pre><code class=\"bash\">helm install dev-rmq-chart bitnami\/rabbitmq --namespace dev-rmq --set persistence.existingClaim=rmq-pvc,ingress.enabled=true,ingress.hostname=dashboard.dev.rmq.cryptopantry.tech,auth.username=rmq_admin,auth.password=devrmquser,ingress.ingressClassName=nginx<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u00a0<code>existingClaim=rmq-pvc<\/code> \u2014 \u0438\u043c\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <code>PVC<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0432\u044b\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u0438;<\/p>\n<\/li>\n<li>\n<p><code>ingress.enabled=true<\/code> \u2014 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c Ingress, \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0431\u043e\u0440\u0434\u044b;<\/p>\n<\/li>\n<li>\n<p><code>ingress.hostname=dashboard.dev.rmq.somedomain.com<\/code> \u2014 \u0430\u0434\u0440\u0435\u0441 \u0431\u043e\u0440\u0434\u044b;<\/p>\n<\/li>\n<li>\n<p><code>auth.username=rmq_admin<\/code> \u0438 <code>auth.password=devrmquser<\/code> \u2014 \u0442\u0443\u0442 \u0432\u0441\u0451 \u0438 \u0442\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u043d\u043e;<\/p>\n<\/li>\n<li>\n<p><code>ingress.ingressClassName=nginx<\/code> \u2014 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043b\u044f Ingress-\u0440\u0435\u0441\u0443\u0440\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0430\u0440\u0442 Helm \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dfc\/518\/057\/dfc5180576193d62a0df33a5713227df.png\" width=\"2212\" height=\"364\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dfc\/518\/057\/dfc5180576193d62a0df33a5713227df.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u043e \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0432 <code>ingress.hostname<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d2b\/c1b\/c3a\/d2bc1bc3a7a4e367f0e4e38d424cf1a3.png\" width=\"2528\" height=\"704\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d2b\/c1b\/c3a\/d2bc1bc3a7a4e367f0e4e38d424cf1a3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0441 \u0443\u0447\u0451\u0442\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 <code>login=rmq_admin<\/code> \u0438 <code>password=devrmquser<\/code>, \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 Admin:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/382\/2fd\/2d3\/3822fd2d3e32e1b60feaf33851f88ce5.png\" width=\"2796\" height=\"752\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/382\/2fd\/2d3\/3822fd2d3e32e1b60feaf33851f88ce5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>qa_user<\/code> \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c <code>qa_pass<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b62\/67c\/71a\/b6267c71a17c9569896a298f5e6e79fa.png\" width=\"2792\" height=\"1134\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b62\/67c\/71a\/b6267c71a17c9569896a298f5e6e79fa.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c virtual host:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0ba\/776\/6e3\/0ba7766e350b0ec909ccdc2dd662e30e.png\" width=\"2800\" height=\"738\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0ba\/776\/6e3\/0ba7766e350b0ec909ccdc2dd662e30e.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u043f\u0440\u0438\u0432\u044f\u0436\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a virtual host:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f67\/383\/08a\/f6738308a42d78cb60252b9dbd7748af.png\" width=\"2716\" height=\"492\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f67\/383\/08a\/f6738308a42d78cb60252b9dbd7748af.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4b8\/788\/b7d\/4b8788b7d306eeac5d1d3266f636c5b5.png\" width=\"2648\" height=\"950\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4b8\/788\/b7d\/4b8788b7d306eeac5d1d3266f636c5b5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! RabbitMQ \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442 \u0438 \u0433\u043e\u0442\u043e\u0432 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3b3\/480\/fb3\/3b3480fb30ce473f8ada3720ae20d5c3.png\" width=\"2738\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3b3\/480\/fb3\/3b3480fb30ce473f8ada3720ae20d5c3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0442\u0430\u043a\u043e\u0439 \u0430\u0434\u0440\u0435\u0441:<\/p>\n<pre><code>RabbitMQ=amqp:\/\/qa_user:qa_pass@dev-rmq-chart-rabbitmq.dev-rmq:5672\/qa_host<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0451, \u043c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u043b\u0438 PostgreSQL, Redis \u0438 RabbitMQ \u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c dev-\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/company\/domclick\/blog\/649167\/\"> https:\/\/habr.com\/ru\/company\/domclick\/blog\/649167\/<\/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_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c, \u0437\u0430\u0447\u0435\u043c \u0432\u043e\u0442 \u044d\u0442\u043e \u0432\u0441\u0451 \u043d\u0443\u0436\u043d\u043e, \u0438\u043b\u0438 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0439\u0442\u0435 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u043a\u0430\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e (\u0437\u0430\u043c\u0435\u0442\u043a\u0443) \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0432 dev-\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes. <\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<ol>\n<li>\n<p><a href=\"#0\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#1\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 PostgreSQL<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#2\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Redis<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#3\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 RabbitMQ<\/a><\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<p><a class=\"anchor\" name=\"0\" id=\"0\"><\/a><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 PostgresSQL, Redis \u0438 RabbitMQ \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438 \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430. \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0440\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <code>Persistent Volume<\/code> (PV) \u0438 <code>Persistent Volume Claim<\/code> (PVC).<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 <code>Helm<\/code>-\u0447\u0430\u0440\u0442\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<\/li>\n<\/ul>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PV \u0438 PVC. \u0415\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f <a href=\"https:\/\/www.youtube.com\/watch?v=8Wk1iI8mMrw&amp;ab_channel=%D0%A1%D0%BB%D1%91%D1%80%D0%BC\">\u043b\u0435\u043a\u0446\u0438\u044f<\/a> \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043c\u0435\u043b\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043c\u043e\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442 \u043d\u0443\u0436\u043d\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kubernetes. \u0412\u043e\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0412\u0435\u0440\u0441\u0438\u044f Kubernetes 1.20+.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0434\u043d\u0430 master-\u043d\u043e\u0434\u0430 \u0438 \u043e\u0434\u043d\u0430 worker-\u043d\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 Ingress-controller.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442 \u043d\u0430 bare-metal, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c MetalLB \u0438\u043b\u0438 PorterLB.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Helm.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043b\u0430\u043c\u043f\u043e\u0432\u044b\u0439 dev-\u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043d\u0430 \u0433\u043e\u043b\u043e\u043c \u0436\u0435\u043b\u0435\u0437\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432 <a href=\"https:\/\/habr.com\/ru\/company\/domclick\/blog\/577964\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439<\/a> \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p><a class=\"anchor\" name=\"1\" id=\"1\"><\/a><\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 PostgreSQL<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441 <code>StorageClass<\/code>, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0444\u0430\u0439\u043b storage.yaml \u0432\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"yaml\">kind: StorageClass apiVersion: storage.k8s.io\/v1 metadata:   name: local-storage provisioner: kubernetes.io\/no-provisioner volumeBindingMode: WaitForFirstConsumer<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441 <code>Persistent Volume<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0444\u0430\u0439\u043b pv.yaml \u0432\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442:<\/p>\n<pre><code class=\"yaml\">apiVersion: v1 kind: PersistentVolume metadata:   name: pv-for-pg   labels:     type: local spec:   capacity:     storage: 4Gi   volumeMode: Filesystem   accessModes:   - ReadWriteOnce   persistentVolumeReclaimPolicy: Retain   storageClassName: local-storage   local:     path: \/devkube\/postgresql   nodeAffinity:     required:       nodeSelectorTerms:       - matchExpressions:         - key: kubernetes.io\/hostname           operator: In           values:           - 457344.cloud4box.ru<\/code><\/pre>\n<p>\u0412 <code>matchExpressions<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0434\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0438\u0441\u043a. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0443\u0437\u043b\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">kubectl get nodes<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0431\u0443\u0434\u0435\u043c \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0441\u043a \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u043c\u0430\u0441\u0442\u0435\u0440-\u043d\u043e\u0434\u0435, \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435. \u041c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/devkube\/postgresql. \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">mkdir -p \/devkube\/postgresql<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441 <code>Persistent Volume<\/code>:<\/p>\n<pre><code class=\"bash\">kubectl apply -f pv.yaml<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435:<\/p>\n<pre><code class=\"bash\">kubectl get pv<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0441 <code>Persistent Volume Claim<\/code>:<\/p>\n<pre><code class=\"yaml\">kind: PersistentVolumeClaim apiVersion: v1 metadata:   name: pg-pvc spec:   storageClassName: \"local-storage\"   accessModes:   - ReadWriteOnce   resources:     requests:       storage: 4Gi<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0441\u0443\u0440\u0441 <code>PVC<\/code> \u0432 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c Postgres \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435. \u041f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u043a \u0441\u0435\u0431\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 Bitnami:<\/p>\n<pre><code class=\"bash\">helm repo add bitnami https:\/\/charts.bitnami.com\/bitnami<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0430\u0440\u0442 Helm \u0441 Postgres:<\/p>\n<pre><code class=\"bash\">helm install dev-pg bitnami\/postgresql --set primary.persistence.existingClaim=pg-pvc,auth.postgresPassword=pgpass<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <code>PVC<\/code>:<\/p>\n<pre><code>kubectl get pvc<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0441\u0443\u0440\u0441 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 <code>bound<\/code>, \u0442\u0435\u043f\u0435\u0440\u044c pod \u0441 Postgres \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/devkube\/postgresql. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <code>pod, statefulset<\/code>:<\/p>\n<pre><code>kubectl get pod,statefulset<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0411\u0430\u0437\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u0439: \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u044b. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0447\u0430\u0440\u0442\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0411\u0414. \u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>1. \u041f\u0440\u043e\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u0440\u0442 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 psql. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430:<\/p>\n<pre><code class=\"bash\">psql -V<\/code><\/pre>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u0430\u0434\u043c\u0438\u043d-\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">export POSTGRES_PASSWORD=$(kubectl get secret --namespace default dev-pg-postgresql -o jsonpath=\"{.data.postgres-password}\" | base64 --decode)<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u0430:<\/p>\n<pre><code>kubectl port-forward --namespace default svc\/dev-pg-postgresql 5432:5432<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430. \u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u043e\u043a\u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a \u044d\u0442\u043e\u0439 \u0436\u0435 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0411\u0414:<\/p>\n<pre><code class=\"bash\">PGPASSWORD=\"$POSTGRES_PASSWORD\" psql --host 127.0.0.1 -U postgres -d postgres -p 5432<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u0442\u0430\u043a, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e:<\/p>\n<pre><code class=\"bash\">psql --host 127.0.0.1 -U postgres -d postgres -p 5432<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>2. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0434\u0443 \u0441 psql \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<p>\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u0430\u0434\u043c\u0438\u043d-\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"pgsql\">export POSTGRES_PASSWORD=$(kubectl get secret --namespace default dev-pg-postgresql -o jsonpath=\"{.data.postgres-password}\" | base64 --decode)<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u0434 \u0441 \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 psql \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432 \u043d\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0411\u0414:<\/p>\n<pre><code class=\"pgsql\">kubectl run dev-pg-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io\/bitnami\/postgresql:14.2.0-debian-10-r22 --env=\"PGPASSWORD=$POSTGRES_PASSWORD\" \\       --command -- psql --host dev-pg-postgresql -U postgres -d postgres -p 5432<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<\/div>\n<\/details>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u043e\u043b\u044c (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f) \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043d\u0435\u0451:<\/p>\n<pre><code class=\"pgsql\">CREATE ROLE qa_user WITH LOGIN ENCRYPTED PASSWORD 'qa-pg-pass';<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u043e\u043b\u0435\u0439:<\/p>\n<pre><code class=\"pgsql\">\\du<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0431\u0430\u0437\u0443, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c qa_user:<\/p>\n<pre><code class=\"pgsql\">CREATE DATABASE qa_db OWNER qa_user;<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f:<\/p>\n<pre><code class=\"pgsql\">\\q<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u0432\u0442\u043e\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c):<\/p>\n<pre><code class=\"bash\">kubectl run dev-pg-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io\/bitnami\/postgresql:14.2.0-debian-10-r22 --env=\"PGPASSWORD=qa-pg-pass\"  --command -- psql --host dev-pg-postgresql -U qa_user -d qa_db -p 5432<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443:<\/p>\n<pre><code class=\"pgsql\">CREATE TABLE qa_table (id int, name varchar(255));<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u044c:<\/p>\n<pre><code class=\"pgsql\">INSERT INTO qa_table VALUES (1, 'first');<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c <code>select<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"pgsql\">SELECT * FROM qa_table;<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u0431\u0430\u0437\u0435:<\/p>\n<pre><code class=\"pgsql\">\\dt+<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e, \u0431\u0430\u0437\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u0430! \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0430\u0434\u0440\u0435\u0441 \u0411\u0414:<\/p>\n<pre><code>DATABASE_URI=postgresql:\/\/qa_user:qa-pg-pass@dev-pg-postgresql:5432\/qa_db<\/code><\/pre>\n<p><a class=\"anchor\" name=\"2\" id=\"2\"><\/a><\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Redis<\/h2>\n<p>Redis \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 <a href=\"https:\/\/github.com\/bitnami\/charts\/tree\/master\/bitnami\/redis#introduction\">\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445<\/a>. \u041c\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0434\u0432\u0443\u043c\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u043c\u0438 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u043e\u0434\u043d\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u043e\u0439 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0431\u0430\u0437\u0443. \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0441\u043e <code>StorageClass<\/code>:<\/p>\n<pre><code class=\"yaml\">kind: StorageClass apiVersion: storage.k8s.io\/v1 metadata:   name: local-storage provisioner: kubernetes.io\/no-provisioner volumeBindingMode: WaitForFirstConsumer<\/code><\/pre>\n<pre><code class=\"yaml\">kubectl apply -f storage.yaml<\/code><\/pre>\n<p>\u0423 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0431\u044b\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u044d\u0442\u043e\u0442 \u0440\u0435\u0441\u0443\u0440\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0441\u044f.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c <code>Persistent Volumes<\/code>. \u0417\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u0435\u043c 2 \u0413\u0431 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 slave-\u0440\u0435\u043f\u043b\u0438\u043a\u0438 \u0438 4 \u0413\u0431 \u0434\u043b\u044f \u043c\u0430\u0441\u0442\u0435\u0440-\u0440\u0435\u043f\u043b\u0438\u043a\u0438. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b\u044b pv-slave1.yaml, pv-slave2.yaml \u0438 pv-master.yaml \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u043d\u0438\u0445 \u044d\u0442\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"yaml\">apiVersion: v1 kind: PersistentVolume metadata:   name: pv-redis-slave1   labels:     type: local spec:   capacity:     storage: 2Gi   volumeMode: Filesystem   accessModes:   - ReadWriteOnce   persistentVolumeReclaimPolicy: Retain   storageClassName: local-storage   local:     path: \/devkube\/redis\/slave1   nodeAffinity:     required:       nodeSelectorTerms:       - matchExpressions:         - key: kubernetes.io\/hostname           operator: In           values:           - 457344.cloud4box.ru<\/code><\/pre>\n<pre><code class=\"yaml\">apiVersion: v1 kind: PersistentVolume metadata:   name: pv-redis-slave2   labels:     type: local spec:   capacity:     storage: 2Gi   volumeMode: Filesystem   accessModes:   - ReadWriteOnce   persistentVolumeReclaimPolicy: Retain   storageClassName: local-storage   local:     path: \/devkube\/redis\/slave2   nodeAffinity:     required:       nodeSelectorTerms:       - matchExpressions:         - key: kubernetes.io\/hostname           operator: In           values:           - 457344.cloud4box.ru<\/code><\/pre>\n<pre><code class=\"yaml\">apiVersion: v1 kind: PersistentVolume metadata:   name: pv-redis-master   labels:     type: local spec:   capacity:     storage: 4Gi   volumeMode: Filesystem   accessModes:   - ReadWriteOnce   persistentVolumeReclaimPolicy: Retain   storageClassName: local-storage   local:     path: \/devkube\/redis\/master   nodeAffinity:     required:       nodeSelectorTerms:       - matchExpressions:         - key: kubernetes.io\/hostname           operator: In           values:           - 457344.cloud4box.ru<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0440\u0435\u043f\u043b\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043d\u043e\u0434\u0435 457344.cloud4box.ru, \u0445\u043e\u0442\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0441\u043a\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0440\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438:<\/p>\n<pre><code class=\"bash\">mkdir -p \/devkube\/redis\/slave1 mkdir -p \/devkube\/redis\/slave2 mkdir -p \/devkube\/redis\/master<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">kubectl apply -f .<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<pre><code class=\"bash\">kubectl get pv<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 <code>PV<\/code> \u0435\u0449\u0451 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b \u0438 \u0436\u0434\u0443\u0442 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u0410 <code>Persistent Volumes Postgres<\/code> \u0443\u0436\u0435 \u0441\u0432\u044f\u0437\u0430\u043d \u0441\u043e \u0441\u0432\u043e\u0438\u043c <code>Persistent Volumes \u0421laim<\/code> (\u0442\u0430\u043a \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f Postgres-\u0431\u0430\u0437\u044b \u0432 Kubernetes).<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <code>PVC<\/code> \u0434\u043b\u044f \u043c\u0430\u0441\u0442\u0435\u0440-\u0440\u0435\u043f\u043b\u0438\u043a\u0438. \u0418\u0445 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u0442\u043e\u043c namespace, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u0442\u0435 \u0431\u0430\u0437\u0443. Redis \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 dev-redis. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e:<\/p>\n<pre><code class=\"bash\">kubectl create ns dev-redis<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<pre><code class=\"bash\">kind: PersistentVolumeClaim apiVersion: v1 metadata:   name: pvc-for-master-redis   namespace: dev-redis spec:   storageClassName: \"local-storage\"   accessModes:   - ReadWriteOnce   resources:     requests:       storage: 4Gi<\/code><\/pre>\n<pre><code>kubectl apply -f pvc-master.yaml<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f slave-\u0440\u0435\u043f\u043b\u0438\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c <code>PVC<\/code> \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0447\u0430\u0440\u0442\u0430 Helm.<\/p>\n<p>\u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Redis. \u041f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u043a \u0441\u0435\u0431\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 Bitnami, \u0435\u0441\u043b\u0438 \u0435\u0449\u0451 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 (\u0443 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d):<\/p>\n<pre><code>helm repo add bitnami https:\/\/charts.bitnami.com\/bitnami<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0430\u0440\u0442 Helm \u0441 Redis:<\/p>\n<pre><code class=\"bash\">helm install dev-redis-chart bitnami\/redis --namespace dev-redis --set global.redis.password=redispass,master.persistence.existingClaim=pvc-for-master-redis,replica.replicaCount=2,replica.persistence.storageClass=local-storage,replica.persistence.size=2Gi<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e:<\/p>\n<ul>\n<li>\n<p><code>password=redispass<\/code> \u2014 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p><code>existingClaim=pvc-for-master-redis<\/code> \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 <code>PVC<\/code> \u0434\u043b\u044f \u043c\u0430\u0441\u0442\u0435\u0440-\u0440\u0435\u043f\u043b\u0438\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p><code>replicaCount, storageClass, size<\/code> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e slave-\u0440\u0435\u043f\u043b\u0438\u043a, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <code>StorageClass<\/code> \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 <code>PV<\/code>. \u042d\u0442\u043e \u0432\u0441\u0451 \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>PVC<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a Redis. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <code>Persistent Volumes<\/code>:<\/p>\n<pre><code>kubectl get pv<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0441\u0442\u0430\u043b\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c <code>PVC<\/code>. \u0418<\/p>\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-330498","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/330498","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=330498"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/330498\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=330498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=330498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=330498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}