{"id":328058,"date":"2022-01-15T15:00:06","date_gmt":"2022-01-15T15:00:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=328058"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=328058","title":{"rendered":"<span>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u043a\u0440\u0435\u0442\u0430\u043c\u0438 \u0432 ArgoCD \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 argocd-vault-plugin \u0441 Kubernetes auth<\/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<h2>\u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 ArgoCD \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u043a\u0440\u044b\u0442\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c credentials (\u043b\u043e\u0433\u0438\u043d\u0430\u043c\u0438, \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438, \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438, etc). \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e ArgoCD \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d <a href=\"https:\/\/argo-cd.readthedocs.io\/en\/stable\/operator-manual\/secret-management\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e credentials<\/a>. \u041f\u043e \u043c\u043e\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043e\u043a \u043a \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u2014 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u043a\u0440\u0435\u0442\u0430\u043c\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c <a href=\"https:\/\/github.com\/argoproj-labs\/argocd-vault-plugin\" rel=\"noopener noreferrer nofollow\">argocd-vault-plugin<\/a> (AVP) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Kubernetes auth \u0432 Vault. \u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439: <strong>argocd-repo-server<\/strong> \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Vault \u043f\u0440\u043e \u043f\u043e\u043c\u043e\u0449\u0438 Service Account token, \u0432 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0435 Secret \u0432  &lt; &#8230; > \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0441\u0435\u043a\u0440\u0435\u0442. <\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"1000\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/199\/f3d\/735\/199f3d735630a11be1a1fb1eca0647d2.gif\" data-width=\"1500\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h2>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ArgoCD<\/h3>\n<p>\u041d\u0438\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0434\u043b\u044f \u0438\u043d\u0441\u0442\u0430\u043b\u044f\u0446\u0438\u0438 ArgoCD \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e helm chart.<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 argocd-server<\/h4>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <strong>argocd-server, <\/strong>\u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430:<\/p>\n<pre><code class=\"yaml\">  # -- [General Argo CD configuration]   # @default -- See [values.yaml]   config:     configManagementPlugins: |       - name: argocd-vault-plugin         generate:           command: [\"argocd-vault-plugin\"]           args: [\"generate\", \".\/\"]<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <strong>main<\/strong>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f <a href=\"https:\/\/argo-cd.readthedocs.io\/en\/stable\/operator-manual\/cluster-bootstrapping\/#app-of-apps-pattern\" rel=\"noopener noreferrer nofollow\"><strong>app of app<\/strong><\/a><strong>, <\/strong>\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 Application:<\/p>\n<pre><code class=\"yaml\">  # -- Deploy ArgoCD Applications within this helm release   # @default -- `[]` (See [values.yaml])   ## Ref: https:\/\/github.com\/argoproj\/argo-cd\/blob\/master\/docs\/operator-manual\/   additionalApplications:     - name: main       namespace: argocd       additionalLabels: {}       additionalAnnotations: {}       project: default       source:         repoURL: https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo.git         targetRevision: master         path: apps         helm:           valueFiles:             - values.yaml       destination:         server: https:\/\/kubernetes.default.svc         namespace: argocd       syncPolicy:         automated:           prune: true           selfHeal: true<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 argocd-repo-server<\/h4>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c AVP \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438, \u043d\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 initContainer. \u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439: \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f argocd-repo-server, initContainer \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 volume \u0442\u0438\u043f\u0430 emptyDir, \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u043a\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0432 argocd-repo-server. <\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 volume \u0438 volumeMounts \u0432 argocd-repo-server:<\/p>\n<pre><code class=\"yaml\">  # -- Additional volumeMounts to the repo server main container   volumeMounts:     - name: custom-tools       mountPath: \/usr\/local\/bin\/argocd-vault-plugin       subPath: argocd-vault-plugin    # -- Additional volumes to the repo server pod   volumes:     - name: custom-tools       emptyDir: {}<\/code><\/pre>\n<p>\u0420\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432 \u0438\u0437 Vault \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <strong>argocd-repo-server, <\/strong>\u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c serviceAccount:<\/p>\n<pre><code class=\"yaml\">  ## Repo server service account   ## If create is set to true, make sure to uncomment the name and update the rbac section below   serviceAccount:     # -- Create repo server service account     create: true     # -- Repo server service account name     name: argocd-repo-server<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 initContainer \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430:<\/p>\n<pre><code class=\"yaml\">  # -- Init containers to add to the repo server pods   initContainers:     - name: download-tools       image: alpine:3.8       command: [ sh, -c ]       args:         - wget -O argocd-vault-plugin           https:\/\/github.com\/argoproj-labs\/argocd-vault-plugin\/releases\/download\/v1.6.0\/argocd-vault-plugin_1.6.0_linux_amd64 &amp;&amp;           chmod +x argocd-vault-plugin &amp;&amp; mv argocd-vault-plugin \/custom-tools       volumeMounts:         - mountPath: \/custom-tools           name: custom-tools<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/blob\/master\/helpers\/argocd-values.yaml\" rel=\"noopener noreferrer nofollow\">argrocd-values.yaml<\/a>, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 github.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432 ArgoCD<\/h4>\n<p>\u0412 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 argocd-values.yaml, \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 ArgoCD, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 minikube.<\/p>\n<p>\u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438:<\/p>\n<pre><code class=\"bash\">git clone git@github.com:dmitrii-dmnk\/argocd-vault-plugin-demo.git; cd  argocd-vault-plugin-demo\/helpers<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 helm:<\/p>\n<pre><code>helm upgrade -i argocd argo\/argo-cd \\     --atomic \\     --create-namespace -n argocd \\     -f argocd-values.yaml \\     --version=3.29.5<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ArgoCD \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Vault<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432 Vault \u0435\u0449\u0451 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 Kubernetes auth, \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">vault auth enable kubernetes<\/code><\/pre>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 Kubernetes auth \u0431\u044b\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432\u044b\u0448\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">vault write auth\/kubernetes\/config \\   issuer=\"https:\/\/kubernetes.default.svc.cluster.local\" \\   token_reviewer_jwt=\"$(cat \/var\/run\/secrets\/kubernetes.io\/serviceaccount\/token)\" \\   kubernetes_host=\"https:\/\/$KUBERNETES_PORT_443_TCP_ADDR:443\" \\   kubernetes_ca_cert=@\/var\/run\/secrets\/kubernetes.io\/serviceaccount\/ca.crt<\/code><\/pre>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>issuer=&#187;https:\/\/kubernetes.default.svc.cluster.local&#187;<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f Vault 1.9.0 \u0438 Kubernetes 1.20 \u0438 \u0432\u044b\u0448\u0435 \u0432\u0435\u0440\u0441\u0438\u0439. \u041d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 Vault \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u043c <a href=\"https:\/\/www.vaultproject.io\/docs\/auth\/kubernetes\" rel=\"noopener noreferrer nofollow\">Kubernetes auth method<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 KV \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 2-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438, \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u043d\u0435\u0433\u043e <strong>test<\/strong> \u0441\u0435\u043a\u0440\u0435\u0442:<\/p>\n<pre><code class=\"bash\">vault secrets enable -path=avp -version=2 kv vault kv put avp\/test sample=secret<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u0441 <strong>policy \u0434\u043b\u044f<\/strong> <strong>argocd-repo-server:<\/strong><\/p>\n<pre><code class=\"bash\">cat &lt;&lt; EOF > \/tmp\/policy.hcl  path \"avp\/data\/test\" { capabilities = [\"read\"] }  EOF vault policy write argocd-repo-server \/tmp\/policy.hcl<\/code><\/pre>\n<p>\u0412 Kubernetes auth \u0441\u043e\u0437\u0434\u0430\u0451\u043c <strong>\u0440\u043e\u043b\u044c \u0434\u043b\u044f argocd-repo-server:<\/strong><\/p>\n<pre><code class=\"bash\">vault write auth\/kubernetes\/role\/argocd-repo-server \\ bound_service_account_names=argocd-repo-server \\   bound_service_account_namespaces=argocd policies=argocd-repo-server<\/code><\/pre>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 App of secrets<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f GitOps \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Application \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f ArgoCD.  \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Application \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0437\u0434\u0430\u0442\u044c Secret \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438\u0437 Vault. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0434\u0451\u043d <a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/blob\/master\/apps\/templates\/app-of-secrets.yaml\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440 Application<\/a> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 env \u0434\u043b\u044f AVP: <\/p>\n<pre><code class=\"yaml\">apiVersion: argoproj.io\/v1alpha1 kind: Application metadata:   name: app-of-secrets   namespace: argocd spec:   destination:     namespace: argocd     server: https:\/\/kubernetes.default.svc   project: default   syncPolicy:     automated:       prune: true       selfHeal: true   source:     path: apps\/secrets     plugin:       env:         - name: AVP_TYPE           value: vault         - name: AVP_AUTH_TYPE           value: k8s         - name: AVP_K8S_ROLE           value: argocd-repo-server         - name: VAULT_ADDR           value: http:\/\/vault.vault:8200       name: argocd-vault-plugin     repoURL: https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo.git     targetRevision: master<\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/blob\/master\/apps\/secrets\/example-secret.yaml\" rel=\"noopener noreferrer nofollow\">Secret \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442<\/a> \u0434\u043b\u044f Application <strong>app-of-secrets<\/strong>. \u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 AVP \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u043f\u0443\u0442\u044c \u043a \u0441\u0435\u043a\u0440\u0435\u0442\u0443 \u0432 Vault. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/argocd-vault-plugin.readthedocs.io\/en\/stable\/config\/#full-list-of-supported-annotation\" rel=\"noopener noreferrer nofollow\">argocd-vault-plugin.readthedocs.io<\/a><\/p>\n<pre><code class=\"yaml\">kind: Secret apiVersion: v1 metadata:   name: example-secret   namespace: default   annotations:     avp.kubernetes.io\/path: \"avp\/data\/test\" type: Opaque stringData:   sample-secret: &lt;sample><\/code><\/pre>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0441\u0435\u043a\u0440\u0435\u0442 \u0432 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u043c \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 Vault. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c hard refresh \u0432 ArgoCD UI, \u043b\u0438\u0431\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"bash\">argocd app sync --force app-of-secrets<\/code><\/pre>\n<h3>\u0418\u0442\u043e\u0433<\/h3>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ArgoCD \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a: \u043f\u043e\u0434\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u044e \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 AVP, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Application \u0441 env \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Secret \u0441\u043e stringData \u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/tree\/master\/helpers\" rel=\"noopener noreferrer nofollow\">\u0431\u043e\u043d\u0443\u0441\u0430<\/a> \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 <a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/blob\/master\/helpers\/autodeploy.sh\" rel=\"noopener noreferrer nofollow\">\u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0431\u0430\u0448\u0435<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 ArgoCD \u0438 Vault \u0432 minikube. \u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0432\u0443\u0435\u0442\u0441\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430, \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/p>\n<div class=\"persona\" persona=\"true\"><img persona=\"true\" class=\"image persona__image\"\/><\/p>\n<h5 class=\"persona__heading\" persona=\"true\"><a class=\"mention\" href=\"\/users\/melpomane\">@melpomane<\/a><\/h5>\n<p persona=\"true\" class=\"persona__text\">\u0414\u0438\u0437\u0430\u0439\u043d\u0435\u0440<\/p>\n<\/div>\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\/post\/645773\/\"> https:\/\/habr.com\/ru\/post\/645773\/<\/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<h2>\u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 ArgoCD \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u043a\u0440\u044b\u0442\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c credentials (\u043b\u043e\u0433\u0438\u043d\u0430\u043c\u0438, \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438, \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438, etc). \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e ArgoCD \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d <a href=\"https:\/\/argo-cd.readthedocs.io\/en\/stable\/operator-manual\/secret-management\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e credentials<\/a>. \u041f\u043e \u043c\u043e\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043e\u043a \u043a \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u2014 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u043a\u0440\u0435\u0442\u0430\u043c\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c <a href=\"https:\/\/github.com\/argoproj-labs\/argocd-vault-plugin\" rel=\"noopener noreferrer nofollow\">argocd-vault-plugin<\/a> (AVP) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Kubernetes auth \u0432 Vault. \u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439: <strong>argocd-repo-server<\/strong> \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Vault \u043f\u0440\u043e \u043f\u043e\u043c\u043e\u0449\u0438 Service Account token, \u0432 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0435 Secret \u0432  &lt; &#8230; > \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0441\u0435\u043a\u0440\u0435\u0442. <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h2>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ArgoCD<\/h3>\n<p>\u041d\u0438\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0434\u043b\u044f \u0438\u043d\u0441\u0442\u0430\u043b\u044f\u0446\u0438\u0438 ArgoCD \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e helm chart.<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 argocd-server<\/h4>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <strong>argocd-server, <\/strong>\u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430:<\/p>\n<pre><code class=\"yaml\">  # -- [General Argo CD configuration]   # @default -- See [values.yaml]   config:     configManagementPlugins: |       - name: argocd-vault-plugin         generate:           command: [\"argocd-vault-plugin\"]           args: [\"generate\", \".\/\"]<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <strong>main<\/strong>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f <a href=\"https:\/\/argo-cd.readthedocs.io\/en\/stable\/operator-manual\/cluster-bootstrapping\/#app-of-apps-pattern\" rel=\"noopener noreferrer nofollow\"><strong>app of app<\/strong><\/a><strong>, <\/strong>\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 Application:<\/p>\n<pre><code class=\"yaml\">  # -- Deploy ArgoCD Applications within this helm release   # @default -- `[]` (See [values.yaml])   ## Ref: https:\/\/github.com\/argoproj\/argo-cd\/blob\/master\/docs\/operator-manual\/   additionalApplications:     - name: main       namespace: argocd       additionalLabels: {}       additionalAnnotations: {}       project: default       source:         repoURL: https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo.git         targetRevision: master         path: apps         helm:           valueFiles:             - values.yaml       destination:         server: https:\/\/kubernetes.default.svc         namespace: argocd       syncPolicy:         automated:           prune: true           selfHeal: true<\/code><\/pre>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 argocd-repo-server<\/h4>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c AVP \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438, \u043d\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 initContainer. \u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439: \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f argocd-repo-server, initContainer \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d. \u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 volume \u0442\u0438\u043f\u0430 emptyDir, \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u043a\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0432 argocd-repo-server. <\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 volume \u0438 volumeMounts \u0432 argocd-repo-server:<\/p>\n<pre><code class=\"yaml\">  # -- Additional volumeMounts to the repo server main container   volumeMounts:     - name: custom-tools       mountPath: \/usr\/local\/bin\/argocd-vault-plugin       subPath: argocd-vault-plugin    # -- Additional volumes to the repo server pod   volumes:     - name: custom-tools       emptyDir: {}<\/code><\/pre>\n<p>\u0420\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432 \u0438\u0437 Vault \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <strong>argocd-repo-server, <\/strong>\u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c serviceAccount:<\/p>\n<pre><code class=\"yaml\">  ## Repo server service account   ## If create is set to true, make sure to uncomment the name and update the rbac section below   serviceAccount:     # -- Create repo server service account     create: true     # -- Repo server service account name     name: argocd-repo-server<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 initContainer \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430:<\/p>\n<pre><code class=\"yaml\">  # -- Init containers to add to the repo server pods   initContainers:     - name: download-tools       image: alpine:3.8       command: [ sh, -c ]       args:         - wget -O argocd-vault-plugin           https:\/\/github.com\/argoproj-labs\/argocd-vault-plugin\/releases\/download\/v1.6.0\/argocd-vault-plugin_1.6.0_linux_amd64 &amp;&amp;           chmod +x argocd-vault-plugin &amp;&amp; mv argocd-vault-plugin \/custom-tools       volumeMounts:         - mountPath: \/custom-tools           name: custom-tools<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/blob\/master\/helpers\/argocd-values.yaml\" rel=\"noopener noreferrer nofollow\">argrocd-values.yaml<\/a>, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 github.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432 ArgoCD<\/h4>\n<p>\u0412 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 argocd-values.yaml, \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 ArgoCD, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 minikube.<\/p>\n<p>\u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438:<\/p>\n<pre><code class=\"bash\">git clone git@github.com:dmitrii-dmnk\/argocd-vault-plugin-demo.git; cd  argocd-vault-plugin-demo\/helpers<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 helm:<\/p>\n<pre><code>helm upgrade -i argocd argo\/argo-cd \\     --atomic \\     --create-namespace -n argocd \\     -f argocd-values.yaml \\     --version=3.29.5<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ArgoCD \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Vault<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432 Vault \u0435\u0449\u0451 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 Kubernetes auth, \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">vault auth enable kubernetes<\/code><\/pre>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 Kubernetes auth \u0431\u044b\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432\u044b\u0448\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">vault write auth\/kubernetes\/config \\   issuer=\"https:\/\/kubernetes.default.svc.cluster.local\" \\   token_reviewer_jwt=\"$(cat \/var\/run\/secrets\/kubernetes.io\/serviceaccount\/token)\" \\   kubernetes_host=\"https:\/\/$KUBERNETES_PORT_443_TCP_ADDR:443\" \\   kubernetes_ca_cert=@\/var\/run\/secrets\/kubernetes.io\/serviceaccount\/ca.crt<\/code><\/pre>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>issuer=&#187;https:\/\/kubernetes.default.svc.cluster.local&#187;<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f Vault 1.9.0 \u0438 Kubernetes 1.20 \u0438 \u0432\u044b\u0448\u0435 \u0432\u0435\u0440\u0441\u0438\u0439. \u041d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 Vault \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u043c <a href=\"https:\/\/www.vaultproject.io\/docs\/auth\/kubernetes\" rel=\"noopener noreferrer nofollow\">Kubernetes auth method<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 KV \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 2-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438, \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u043d\u0435\u0433\u043e <strong>test<\/strong> \u0441\u0435\u043a\u0440\u0435\u0442:<\/p>\n<pre><code class=\"bash\">vault secrets enable -path=avp -version=2 kv vault kv put avp\/test sample=secret<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u0441 <strong>policy \u0434\u043b\u044f<\/strong> <strong>argocd-repo-server:<\/strong><\/p>\n<pre><code class=\"bash\">cat &lt;&lt; EOF > \/tmp\/policy.hcl  path \"avp\/data\/test\" { capabilities = [\"read\"] }  EOF vault policy write argocd-repo-server \/tmp\/policy.hcl<\/code><\/pre>\n<p>\u0412 Kubernetes auth \u0441\u043e\u0437\u0434\u0430\u0451\u043c <strong>\u0440\u043e\u043b\u044c \u0434\u043b\u044f argocd-repo-server:<\/strong><\/p>\n<pre><code class=\"bash\">vault write auth\/kubernetes\/role\/argocd-repo-server \\ bound_service_account_names=argocd-repo-server \\   bound_service_account_namespaces=argocd policies=argocd-repo-server<\/code><\/pre>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 App of secrets<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f GitOps \u043f\u043e\u0434\u0445\u043e\u0434\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Application \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f ArgoCD.  \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Application \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0437\u0434\u0430\u0442\u044c Secret \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438\u0437 Vault. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0434\u0451\u043d <a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/blob\/master\/apps\/templates\/app-of-secrets.yaml\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440 Application<\/a> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 env \u0434\u043b\u044f AVP: <\/p>\n<pre><code class=\"yaml\">apiVersion: argoproj.io\/v1alpha1 kind: Application metadata:   name: app-of-secrets   namespace: argocd spec:   destination:     namespace: argocd     server: https:\/\/kubernetes.default.svc   project: default   syncPolicy:     automated:       prune: true       selfHeal: true   source:     path: apps\/secrets     plugin:       env:         - name: AVP_TYPE           value: vault         - name: AVP_AUTH_TYPE           value: k8s         - name: AVP_K8S_ROLE           value: argocd-repo-server         - name: VAULT_ADDR           value: http:\/\/vault.vault:8200       name: argocd-vault-plugin     repoURL: https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo.git     targetRevision: master<\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/blob\/master\/apps\/secrets\/example-secret.yaml\" rel=\"noopener noreferrer nofollow\">Secret \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442<\/a> \u0434\u043b\u044f Application <strong>app-of-secrets<\/strong>. \u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 AVP \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u043f\u0443\u0442\u044c \u043a \u0441\u0435\u043a\u0440\u0435\u0442\u0443 \u0432 Vault. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/argocd-vault-plugin.readthedocs.io\/en\/stable\/config\/#full-list-of-supported-annotation\" rel=\"noopener noreferrer nofollow\">argocd-vault-plugin.readthedocs.io<\/a><\/p>\n<pre><code class=\"yaml\">kind: Secret apiVersion: v1 metadata:   name: example-secret   namespace: default   annotations:     avp.kubernetes.io\/path: \"avp\/data\/test\" type: Opaque stringData:   sample-secret: &lt;sample><\/code><\/pre>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0441\u0435\u043a\u0440\u0435\u0442 \u0432 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u043c \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 Vault. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c hard refresh \u0432 ArgoCD UI, \u043b\u0438\u0431\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"bash\">argocd app sync --force app-of-secrets<\/code><\/pre>\n<h3>\u0418\u0442\u043e\u0433<\/h3>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ArgoCD \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a: \u043f\u043e\u0434\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u044e \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 AVP, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Application \u0441 env \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Secret \u0441\u043e stringData \u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/tree\/master\/helpers\" rel=\"noopener noreferrer nofollow\">\u0431\u043e\u043d\u0443\u0441\u0430<\/a> \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 <a href=\"https:\/\/github.com\/dmitrii-dmnk\/argocd-vault-plugin-demo\/blob\/master\/helpers\/autodeploy.sh\" rel=\"noopener noreferrer nofollow\">\u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0431\u0430\u0448\u0435<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 ArgoCD \u0438 Vault \u0432 minikube. \u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0432\u0443\u0435\u0442\u0441\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430, \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/p>\n<div class=\"persona\" persona=\"true\">\n<h5 class=\"persona__heading\" persona=\"true\"><a class=\"mention\" href=\"\/users\/melpomane\">@melpomane<\/a><\/h5>\n<p persona=\"true\" class=\"persona__text\">\u0414\u0438\u0437\u0430\u0439\u043d\u0435\u0440<\/p>\n<\/div>\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\/post\/645773\/\"> https:\/\/habr.com\/ru\/post\/645773\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-328058","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/328058","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=328058"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/328058\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=328058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=328058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=328058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}