<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Armory Docs – Work with Secrets in Spinnaker</title><link>/continuous-deployment/armory-admin/secrets/</link><description>Recent content in Work with Secrets in Spinnaker on Armory Docs</description><generator>Hugo -- gohugo.io</generator><atom:link href="/continuous-deployment/armory-admin/secrets/index.xml" rel="self" type="application/rss+xml"/><item><title>Continuous-Deployment: Configure Hashicorp's Vault for Kubernetes Auth</title><link>/continuous-deployment/armory-admin/secrets/vault-k8s-configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/continuous-deployment/armory-admin/secrets/vault-k8s-configuration/</guid><description>
&lt;blockquote>
&lt;p>Configuration of Vault for the Kubernetes auth method requires configuring both Vault and Kubernetes.&lt;/p>
&lt;/blockquote>
&lt;h2 id="configure-kubernetes">Configure Kubernetes&lt;/h2>
&lt;p>Create a Kubernetes Service Account.&lt;/p>
&lt;p>&lt;strong>vault-auth-service-account.yml&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>---
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">apiVersion&lt;/span>: rbac.authorization.k8s.io/v1beta1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">kind&lt;/span>: ClusterRoleBinding
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">metadata&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">name&lt;/span>: role-tokenreview-binding
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">namespace&lt;/span>: default
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">roleRef&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">apiGroup&lt;/span>: rbac.authorization.k8s.io
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">kind&lt;/span>: ClusterRole
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">name&lt;/span>: system:auth-delegator
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">subjects&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>- &lt;span style="color:#ff79c6">kind&lt;/span>: ServiceAccount
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">name&lt;/span>: vault-auth
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">namespace&lt;/span>: default
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Create a service account, &amp;#39;vault-auth&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ kubectl -n default create serviceaccount vault-auth
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Update the &amp;#39;vault-auth&amp;#39; service account&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ kubectl -n default apply --filename vault-auth-service-account.yml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="configure-vault">Configure Vault&lt;/h2>
&lt;blockquote>
&lt;p>This guide assumes that &lt;a href="https://www.vaultproject.io/api/secret/kv/kv-v1.html">Key/Value version 1&lt;/a> secret engine is enabled at &lt;code>secret/&lt;/code>.&lt;/p>
&lt;/blockquote>
&lt;p>Create a read-only policy &lt;code>spinnaker-kv-ro&lt;/code> in Vault.&lt;/p>
&lt;p>&lt;strong>spinnaker-kv-ro.hcl&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-hcl" data-lang="hcl">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># For K/V v1 secrets engine
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span>&lt;span style="color:#ff79c6">path&lt;/span> &lt;span style="color:#f1fa8c">&amp;#34;secret/spinnaker/*&amp;#34;&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> capabilities &lt;span style="color:#ff79c6">=&lt;/span> [&lt;span style="color:#f1fa8c">&amp;#34;read&amp;#34;, &amp;#34;list&amp;#34;&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}&lt;span style="color:#6272a4">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># For K/V v2 secrets engine
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4">&lt;/span>&lt;span style="color:#ff79c6">path&lt;/span> &lt;span style="color:#f1fa8c">&amp;#34;secret/data/spinnaker/*&amp;#34;&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> capabilities &lt;span style="color:#ff79c6">=&lt;/span> [&lt;span style="color:#f1fa8c">&amp;#34;read&amp;#34;, &amp;#34;list&amp;#34;&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>$ vault policy write spinnaker-kv-ro spinnaker-kv-ro.hcl
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Set environment variables required for Vault configuration.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Set VAULT_SA_NAME to the service account you created earlier&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ &lt;span style="color:#8be9fd;font-style:italic">export&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">VAULT_SA_NAME&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#ff79c6">$(&lt;/span>kubectl -n default get sa vault-auth -o &lt;span style="color:#8be9fd;font-style:italic">jsonpath&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;{.secrets[*][&amp;#39;name&amp;#39;]}&amp;#34;&lt;/span>&lt;span style="color:#ff79c6">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Set SA_JWT_TOKEN value to the service account JWT used to access the TokenReview API&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ &lt;span style="color:#8be9fd;font-style:italic">export&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">SA_JWT_TOKEN&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#ff79c6">$(&lt;/span>kubectl -n default get secret &lt;span style="color:#8be9fd;font-style:italic">$VAULT_SA_NAME&lt;/span> -o &lt;span style="color:#8be9fd;font-style:italic">jsonpath&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;{.data.token}&amp;#34;&lt;/span> | base64 --decode; &lt;span style="color:#8be9fd;font-style:italic">echo&lt;/span>&lt;span style="color:#ff79c6">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Set SA_CA_CRT to the PEM encoded CA cert used to talk to Kubernetes API&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ &lt;span style="color:#8be9fd;font-style:italic">export&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">SA_CA_CRT&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#ff79c6">$(&lt;/span>kubectl -n default get secret &lt;span style="color:#8be9fd;font-style:italic">$VAULT_SA_NAME&lt;/span> -o &lt;span style="color:#8be9fd;font-style:italic">jsonpath&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;{.data[&amp;#39;ca\.crt&amp;#39;]}&amp;#34;&lt;/span> | base64 --decode; &lt;span style="color:#8be9fd;font-style:italic">echo&lt;/span>&lt;span style="color:#ff79c6">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Look in your cloud provider console for this value&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ &lt;span style="color:#8be9fd;font-style:italic">export&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">K8S_HOST&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&amp;lt;https://your_API_server_endpoint&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;div class="alert alert-info" role="alert">
&lt;h4 class="alert-heading">NOTE on TTL and Token Renewal&lt;/h4>
&lt;p>The Kubernetes Vault Auth Secrets Engine does not currently support token renewal. As such the &lt;code>spinnaker&lt;/code> role created below provides a &lt;code>TTL&lt;/code> of &lt;code>two months&lt;/code>.&lt;/p>
&lt;p>&lt;strong>Note&lt;/strong> By default, Vault has a max_ttl parameter set to &lt;code>768h0m0s&lt;/code> - that&amp;rsquo;s 32 days. If you want to set the &lt;code>TTL&lt;/code> to a higher value, you need to modify this parameter.&lt;/p>
&lt;p>&lt;strong>Important:&lt;/strong> Spinnaker must be redeployed sometime during the defined &lt;code>TTL&lt;/code> window &amp;ndash; Armory recommends this be done by updating to a new version of Spinnaker and running &lt;code>kubectl -n &amp;lt;spinnaker namespace&amp;gt; apply -f &amp;lt;SpinnakerService manifest&amp;gt;&lt;/code>.&lt;/p>
&lt;/div>
&lt;p>Next, configure Vault&amp;rsquo;s Kubernetes auth method.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Enable the Kubernetes auth method at the default path (&amp;#34;kubernetes&amp;#34;)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ vault auth &lt;span style="color:#8be9fd;font-style:italic">enable&lt;/span> kubernetes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Tell Vault how to communicate with the Kubernetes cluster&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ vault write auth/kubernetes/config &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">token_reviewer_jwt&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span>&lt;span style="color:#8be9fd;font-style:italic">$SA_JWT_TOKEN&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span> &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">kubernetes_host&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span>&lt;span style="color:#8be9fd;font-style:italic">$K8S_HOST&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span> &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">kubernetes_ca_cert&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span>&lt;span style="color:#8be9fd;font-style:italic">$SA_CA_CRT&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Create a role named, &amp;#39;spinnaker&amp;#39; to map Kubernetes Service Account to&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6272a4"># Vault policies and default token TTL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>$ vault write auth/kubernetes/role/spinnaker &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">bound_service_account_names&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>default &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">bound_service_account_namespaces&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#f1fa8c">&amp;#39;*&amp;#39;&lt;/span> &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">policies&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>spinnaker-kv-ro &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">ttl&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>1440h
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="verify-configuration">Verify Configuration&lt;/h2>
&lt;p>It is time verify that the Kubernetes auth method has been properly configured.&lt;/p>
&lt;p>Deploy Armory&amp;rsquo;s &lt;a href="https://github.com/armory/troubleshooting-toolbox/blob/master/docker-debugging-tools/Dockerfile">debug container&lt;/a> into your cluster &amp;ndash; this container has the Vault cli pre-installed.&lt;/p>
&lt;blockquote>
&lt;p>This should be deployed into the same namespace as your Spinnaker installation.&lt;/p>
&lt;/blockquote>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>kubectl apply -f https://raw.githubusercontent.com/armory/troubleshooting-toolbox/master/docker-debugging-tools/deployment.yml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>exec&lt;/code> into the pod.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8be9fd;font-style:italic">POD_NAME&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#ff79c6">$(&lt;/span>kubectl get pod -l &lt;span style="color:#8be9fd;font-style:italic">app&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>debugging-tools -o go-template --template &lt;span style="color:#f1fa8c">&amp;#39;{{range .items}}{{.metadata.name}}{{&amp;#34;\n&amp;#34;}}{{end}}&amp;#39;&lt;/span> --sort-by&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;.status.startTime&amp;#34;&lt;/span> | tail -n 1&lt;span style="color:#ff79c6">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>kubectl &lt;span style="color:#8be9fd;font-style:italic">exec&lt;/span> -it &lt;span style="color:#8be9fd;font-style:italic">$POD_NAME&lt;/span> bash
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Test the auth method.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8be9fd;font-style:italic">export&lt;/span> &lt;span style="color:#8be9fd;font-style:italic">VAULT_ADDR&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#f1fa8c">&amp;#39;http://your.vault.address:port&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8be9fd;font-style:italic">SA_TOKEN&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#ff79c6">$(&lt;/span>cat /var/run/secrets/kubernetes.io/serviceaccount/token&lt;span style="color:#ff79c6">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>vault write auth/kubernetes/login &lt;span style="color:#8be9fd;font-style:italic">role&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>spinnaker &lt;span style="color:#8be9fd;font-style:italic">jwt&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&lt;span style="color:#8be9fd;font-style:italic">$SA_TOKEN&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This command should return output like the following&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>Key Value
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>--- -----
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token s.bKSSrYOcETCADGvGxhbDaaaD
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token_accessor 0ybx2CEPZqxBEwFk8jUPkBk7
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token_duration 24h
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token_renewable &lt;span style="color:#8be9fd;font-style:italic">true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token_policies &lt;span style="color:#ff79c6">[&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;default&amp;#34;&lt;/span> &lt;span style="color:#f1fa8c">&amp;#34;spinnaker-kv-ro&amp;#34;&lt;/span>&lt;span style="color:#ff79c6">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>identity_policies &lt;span style="color:#ff79c6">[]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>policies &lt;span style="color:#ff79c6">[&lt;/span>&lt;span style="color:#f1fa8c">&amp;#34;default&amp;#34;&lt;/span> &lt;span style="color:#f1fa8c">&amp;#34;spinnaker-kv-ro&amp;#34;&lt;/span>&lt;span style="color:#ff79c6">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token_meta_role spinnaker
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token_meta_service_account_name default
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token_meta_service_account_namespace default
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token_meta_service_account_secret_name default-token-h9knn
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>token_meta_service_account_uid 13cee6Dbc-0bc2-11e9-9fd2-0a32f8e530cc
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Using the token from the output above allows for the following:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>vault login s.bKSSrYOcETCADGvGxhbDaaaD
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Once logged in you should be able to read secrets:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>vault kv get secret/spinnaker/test
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>As a reminder, the policy we created provides RO access &lt;em>only&lt;/em> so you will need to have written the secret using a separate authenticated client.&lt;/p></description></item><item><title>Continuous-Deployment: Store Spinnaker Secrets in HashiCorp Vault</title><link>/continuous-deployment/armory-admin/secrets/secrets-vault/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/continuous-deployment/armory-admin/secrets/secrets-vault/</guid><description>
&lt;p>&lt;img src="/images/proprietary.svg" alt="Proprietary">&lt;/p>
&lt;blockquote>
&lt;p>In this example, you use the default KV secret engine called &lt;code>secret&lt;/code> and store GitHub credentials, a kubeconfig file, and a Java keystore for SAML SSO.&lt;/p>
&lt;/blockquote>
&lt;h2 id="authentication-with-vault-servers">Authentication with Vault servers&lt;/h2>
&lt;p>We currently support two methods of authentication with Vault servers.&lt;/p>
&lt;h3 id="1-kubernetes-service-account-recommended">1. Kubernetes service account (recommended)&lt;/h3>
&lt;p>You&amp;rsquo;ll need to configure Vault to authenticate with Kubernetes per our &lt;a href="/continuous-deployment/armory-admin/secrets/vault-k8s-configuration/">Vault Configuration Guide&lt;/a> or HashiCorp&amp;rsquo;s &lt;a href="https://www.vaultproject.io/docs/auth/kubernetes.html#configuration">documentation&lt;/a>.&lt;/p>
&lt;p>Note: If multiple clusters need to access the same Vault server, you&amp;rsquo;ll need to use the &lt;a href="https://www.vaultproject.io/docs/commands/auth/enable.html#usage">-path flag&lt;/a> and give each cluster a different path name. This becomes &lt;code>&amp;lt;cluster auth path&amp;gt;&lt;/code> in the example below. If using just one cluster, you can use the default &lt;code>vault auth enable kubernetes&lt;/code> command, in which case your path will be &lt;code>kubernetes&lt;/code>.&lt;/p>
&lt;p>After configuring authentication on the Vault side, use the following configuration to enable Vault secrets in Spinnaker:&lt;/p>
&lt;p>Add the following snippet to the &lt;code>SpinnakerService&lt;/code> manifest:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">apiVersion&lt;/span>: spinnaker.armory.io/v1alpha2
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">kind&lt;/span>: SpinnakerService
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">metadata&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">name&lt;/span>: spinnaker
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">spec&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">spinnakerConfig&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">config&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">armory&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">secrets&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">vault&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">enabled&lt;/span>: &lt;span style="color:#ff79c6">true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">authMethod&lt;/span>: KUBERNETES &lt;span style="color:#6272a4"># Method used to authenticate with the Vault endpoint. Must be either KUBERNETES for Kubernetes service account auth or TOKEN for Vault token auth. The TOKEN method will require a VAULT_TOKEN environment variable set for Operator and the services. &lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">url&lt;/span>: &amp;lt;Vault server URL&amp;gt;:&amp;lt;port, if required&amp;gt; &lt;span style="color:#6272a4"># URL of the Vault endpoint from Spinnaker services.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">role&lt;/span>: &amp;lt;Vault role&amp;gt; &lt;span style="color:#6272a4"># (Applies to KUBERNETES authentication method) Name of the role against which the login is being attempted.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#6272a4"># path: &amp;lt;k8s cluster path&amp;gt; (Optional; default: kubernetes) Applies to KUBERNETES authentication method) Path of the kubernetes authentication backend mount. Default is &amp;#34;kubernetes&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="2-token-authentication">2. Token authentication&lt;/h3>
&lt;p>This method is not recommended, but it is supported if you choose to use it. Armory recommends this for testing and development purposes only. For token authentication, you need to have a &lt;code>VAULT_TOKEN&lt;/code> environment variable set in the Halyard container of the Operator pod as well as each of the services.&lt;/p>
&lt;p>Use the following configuration to enable Vault secrets using token auth:&lt;/p>
&lt;p>Add the following snippet to the &lt;code>SpinnakerService&lt;/code> manifest:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">apiVersion&lt;/span>: spinnaker.armory.io/v1alpha2
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">kind&lt;/span>: SpinnakerService
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">metadata&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">name&lt;/span>: spinnaker
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">spec&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">spinnakerConfig&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">config&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">armory&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">secrets&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">vault&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">enabled&lt;/span>: &lt;span style="color:#ff79c6">true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">authMethod&lt;/span>: TOKEN &lt;span style="color:#6272a4"># Method used to authenticate with the Vault endpoint. Must be either KUBERNETES for Kubernetes service account auth or TOKEN for Vault token auth. The TOKEN method will require a VAULT_TOKEN environment variable set for Operator and the services. &lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">url&lt;/span>: &amp;lt;Vault server URL&amp;gt;:&amp;lt;port if required&amp;gt; &lt;span style="color:#6272a4"># URL of the Vault endpoint from Spinnaker services.&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="configuring-the-operator-to-use-vault-secrets">Configuring the Operator to use Vault secrets&lt;/h2>
&lt;p>If you are using the Armory Operator, set up a &lt;a href="/continuous-deployment/installation/armory-operator/op-advanced-config/">custom Halyard configuration&lt;/a> with this content:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">secrets&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">vault&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">enabled&lt;/span>: &lt;span style="color:#ff79c6">true&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">url&lt;/span>: &amp;lt;Vault server URL&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">authMethod&lt;/span>: KUBERNETES
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">role&lt;/span>: &amp;lt;Vault role&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">path&lt;/span>: &amp;lt;k8s cluster path&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Once you&amp;rsquo;ve mounted your &lt;code>ConfigMap&lt;/code> to the &lt;code>spinnaker-operator&lt;/code> deployment, it restarts the Halyard container with your Vault config.&lt;/p>
&lt;h2 id="storing-secrets">Storing secrets&lt;/h2>
&lt;p>To store a file, simply prepend the file path with &lt;code>@&lt;/code>. It accepts relative paths but cannot resolve &lt;code>~&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>vault kv put secret/spinnaker/kubernetes &lt;span style="color:#8be9fd;font-style:italic">config&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>@path/to/kube/config
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The command above stores a single key-value pair at the &lt;code>secret/spinnaker/kubernetes&lt;/code> path. &lt;strong>Any updates to that path will replace the existing values even if using a different key!&lt;/strong> In order to store multiple secrets at the same path, it must be done in a single command, like so:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>vault kv put secret/spinnaker/github &lt;span style="color:#8be9fd;font-style:italic">password&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&amp;lt;password&amp;gt; &lt;span style="color:#8be9fd;font-style:italic">token&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>&amp;lt;token&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Otherwise, just store different secrets at different paths, like we&amp;rsquo;re doing in these examples.&lt;/p>
&lt;p>Make sure to base64 encode any binary files:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>base64 -i saml.jks -o saml.b64
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>vault kv put secret/spinnaker/saml &lt;span style="color:#8be9fd;font-style:italic">base64keystore&lt;/span>&lt;span style="color:#ff79c6">=&lt;/span>@saml.b64
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="referencing-secrets">Referencing secrets&lt;/h2>
&lt;p>Now that secrets are safely stored in Vault, reference them in config files with the following syntax:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encrypted:vault!e:&amp;lt;secret engine&amp;gt;!p:&amp;lt;path to secret&amp;gt;!k:&amp;lt;key&amp;gt;!b:&amp;lt;is base64 encoded?&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;p>Parameters can be provided in any order.&lt;/p>
&lt;ul>
&lt;li>&lt;code>!&lt;/code>: &lt;strong>required&lt;/strong> is used as a delimiter between parameters&lt;/li>
&lt;li>&lt;code>e&lt;/code>: &lt;strong>required&lt;/strong> Vault&amp;rsquo;s Secret Engine.&lt;/li>
&lt;li>&lt;code>p&lt;/code>: &lt;strong>required&lt;/strong> Path to your secret, ex: &lt;code>spinnaker/github&lt;/code>&lt;/li>
&lt;li>&lt;code>k&lt;/code>: &lt;strong>required&lt;/strong> Key of the secret.&lt;/li>
&lt;li>&lt;code>b&lt;/code>: &lt;strong>optional&lt;/strong> If the value is a base64 encoded value or file, set this to &lt;code>true&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>Example of how it&amp;rsquo;s used in your YAML configs&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yml" data-lang="yml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">github&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">password&lt;/span>: encrypted:vault!e:secret!p:spinnaker/github!k:password
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">kubernetes&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">kubeconfigFile&lt;/span>: encrypted:vault!e:secret!p:spinnaker/kubernetes!k:config
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">gate&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">javaKeyStoreBinary&lt;/span>: encrypted:vault!e:secret!p:spinnaker/saml!k:base64keystore!b:true
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Continuous-Deployment: Secrets in Kubernetes</title><link>/continuous-deployment/armory-admin/secrets/secrets-kubernetes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/continuous-deployment/armory-admin/secrets/secrets-kubernetes/</guid><description>
&lt;blockquote>
&lt;p>Note: Storing Spinnaker secrets in a Kubernetes secret is only supported if you&amp;rsquo;re using the Operator to deploy and manage Spinnaker. Additionally, you cannot encrypt configuration secrets for the UI (Deck) using the Kubernetes secret engine.&lt;/p>
&lt;/blockquote>
&lt;h2 id="creating-a-kubernetes-secret-for-spinnaker-to-use">Creating a Kubernetes secret for Spinnaker to use&lt;/h2>
&lt;p>This example uses a Kubernetes secret to store GitHub credentials and a kubeconfig file.&lt;/p>
&lt;p>Spinnaker&lt;sup>TM&lt;/sup> can read secrets only within its own namespace. It cannot access Kubernetes secrets stored in a different namespace. In this document, assume that Spinnaker lives in the namespace &lt;code>spinnaker&lt;/code>.&lt;/p>
&lt;p>You can store files as well as individual text values in Kubernetes secrets to be referenced by Spinnaker. To create the secret you can use this command, assuming you have a file named &lt;code>kubeconfig-prod&lt;/code> where you are running the command:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>kubectl -n spinnaker create secret generic spin-secrets &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> --from-file&lt;span style="color:#ff79c6">=&lt;/span>kubeconfig-prod &lt;span style="color:#f1fa8c">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f1fa8c">&lt;/span> --from-literal&lt;span style="color:#ff79c6">=&lt;/span>github-token&lt;span style="color:#ff79c6">=&lt;/span>aaaaaabbbbbbbbccccccccc
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The command will create a secret named &lt;code>spin-secrets&lt;/code> in the &lt;code>spinnaker&lt;/code> namespace, having two keys: one is a kubeconfig file with key &lt;code>kubeconfig-prod&lt;/code> , and the other is a text value for a GitHub token with key &lt;code>github-token&lt;/code>.&lt;/p>
&lt;p>Kustomize also has a secret generator, so you can automatically deploy secrets using Kustomize along with the &lt;code>SpinnakerService&lt;/code> manifest. This is a &lt;code>kustomization.yml&lt;/code> file that creates the same secret as above:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">apiVersion&lt;/span>: kustomize.config.k8s.io/v1beta1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">kind&lt;/span>: Kustomization
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">secretGenerator&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - &lt;span style="color:#ff79c6">name&lt;/span>: spin-secrets
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">files&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - kubeconfig-prod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">literals&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> - github-token=aaaaaabbbbbbbbccccccccc
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For more information on how to create secrets in Kubernetes refer to the &lt;a href="https://kubernetes.io/docs/concepts/configuration/secret/#creating-your-own-secrets">official Kubernetes docs&lt;/a> or the &lt;a href="https://github.com/kubernetes-sigs/kustomize/blob/master/examples/secretGeneratorPlugin.md">Kustomize docs&lt;/a>.&lt;/p>
&lt;h2 id="referencing-secrets">Referencing secrets&lt;/h2>
&lt;p>You reference secret values in your config with the following format:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encrypted:k8s!n:&amp;lt;secret name&amp;gt;!k:&amp;lt;secret key&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Similarly you can reference secret files:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encryptedFile:k8s!n:&amp;lt;secret name&amp;gt;!k:&amp;lt;secret key&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For example, to reference the GitHub token:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encrypted:k8s!n:spin-secrets!k:github-token
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And to reference the content of our kubeconfig file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encryptedFile:k8s!n:spin-secrets!k:kubeconfig-prod
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Continuous-Deployment: Secrets with Google Cloud Storage</title><link>/continuous-deployment/armory-admin/secrets/secrets-gcs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/continuous-deployment/armory-admin/secrets/secrets-gcs/</guid><description>
&lt;blockquote>
&lt;p>This example uses a bucket (&lt;code>mybucket&lt;/code>) to store GitHub credentials and a kubeconfig file.&lt;/p>
&lt;/blockquote>
&lt;h2 id="authorize-spinnaker-to-access-the-gcs-bucket">Authorize Spinnaker to access the GCS bucket&lt;/h2>
&lt;p>Since you&amp;rsquo;re storing sensitive information, make sure to protect the bucket by restricting access and &lt;a href="https://cloud.google.com/storage/docs/encryption/">enabling encryption&lt;/a>.&lt;/p>
&lt;p>Remember to run the Operator deployment and Spinnaker services with permissions to read that content.&lt;/p>
&lt;h2 id="storing-secrets">Storing secrets&lt;/h2>
&lt;p>Store your GitHub credentials in &lt;code>mybucket/spinnaker-secrets.yml&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">github&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">password&lt;/span>: &amp;lt;PASSWORD&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">token&lt;/span>: &amp;lt;TOKEN&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Note&lt;/strong>: You can store the password under different keys than &lt;code>github.password&lt;/code> and &lt;code>github.token&lt;/code>. To do so, change how you reference the secret.&lt;/p>
&lt;h2 id="referencing-secrets">Referencing secrets&lt;/h2>
&lt;p>Now that secrets are securely stored in the bucket, you reference them in your config files with the following format:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encrypted:gcs!b:&amp;lt;bucket&amp;gt;!f:&amp;lt;path to file&amp;gt;!k:&amp;lt;optional yaml key&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For example, to reference &lt;code>github.password&lt;/code> from the file above, use:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encrypted:gcs!b:mybucket!f:spinnaker-secrets.yml!k:github.password
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>To reference the content of our kubeconfig file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encrypted:gcs!f:mykubeconfig!b:mybucket
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Continuous-Deployment: Secrets with S3</title><link>/continuous-deployment/armory-admin/secrets/secrets-s3/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/continuous-deployment/armory-admin/secrets/secrets-s3/</guid><description>
&lt;blockquote>
&lt;p>See the S3 &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/gsg/GetStartedWithS3.html">Getting Started Guide&lt;/a> for more information on encryption in S3.
This example uses a bucket (&lt;code>mybucket&lt;/code>) in the &lt;code>us-west-2&lt;/code> region to store GitHub credentials and a kubeconfig file. You reference the bucket by its URL &lt;code>mybucket.us-west-2.amazonaws.com&lt;/code>.&lt;/p>
&lt;/blockquote>
&lt;h2 id="authorize-spinnaker-to-access-the-s3-bucket">Authorize Spinnaker to access the S3 bucket&lt;/h2>
&lt;p>Since you&amp;rsquo;re storing sensitive information, make sure to protect the bucket by restricting access and &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/user-guide/default-bucket-encryption.html">enabling encryption&lt;/a>.&lt;/p>
&lt;p>Remember to run the Operator and Spinnaker&lt;sup>TM&lt;/sup> services with IAM roles that allow them to read the keys stored in the AWS S3 Bucket.&lt;/p>
&lt;h2 id="storing-secrets">Storing secrets&lt;/h2>
&lt;h3 id="storing-credentials">Storing credentials&lt;/h3>
&lt;p>Store your GitHub credentials in &lt;code>mybucket/spinnaker-secrets.yml&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff79c6">github&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">password&lt;/span>: &amp;lt;PASSWORD&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">token&lt;/span>: &amp;lt;TOKEN&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Note: &lt;em>You could choose to store the password under different keys than &lt;code>github.password&lt;/code> and &lt;code>github.token&lt;/code>. You’d just need to change how to reference the secret further down.&lt;/em>&lt;/p>
&lt;h3 id="storing-sensitive-files">Storing sensitive files&lt;/h3>
&lt;p>Some Spinnaker configuration uses information stored as files. For example, upload the &lt;code>kubeconfig&lt;/code> file of your Kubernetes account directly to &lt;code>mybucket/mykubeconfig&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>aws s3 cp /path/to/mykubeconfig s3://mybucket/mykubeconfig
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="referencing-secrets">Referencing secrets&lt;/h2>
&lt;p>Now that secrets are safely stored in the bucket, you reference them from your config files with the following format. The S3 specific parameters (&lt;code>r:&amp;lt;region&amp;gt;&lt;/code>, &lt;code>b:&amp;lt;bucket&amp;gt;&lt;/code>, etc) can be in any order:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encrypted:s3!r:&amp;lt;region&amp;gt;!b:&amp;lt;bucket&amp;gt;!f:&amp;lt;path to file&amp;gt;!k:&amp;lt;optional yaml key&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For example, to reference &lt;code>github.password&lt;/code> from the file above, we&amp;rsquo;ll use:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encrypted:s3!r:us-west-2!b:mybucket!f:spinnaker-secrets.yml!k:github.password
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And to reference the content of our kubeconfig file:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encryptedFile:s3!r:us-west-2!b:mybucket!f:mykubeconfig
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Continuous-Deployment: Secrets with AWS Secrets Manager</title><link>/continuous-deployment/armory-admin/secrets/secrets-aws-sm/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/continuous-deployment/armory-admin/secrets/secrets-aws-sm/</guid><description>
&lt;blockquote>
&lt;p>See the AWS Secrets Manager &lt;a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html">User Guide&lt;/a> for how to set up AWS Secrets Manager,&lt;/p>
&lt;/blockquote>
&lt;h2 id="authorize-spinnaker-to-access-the-aws-secrets-manager">Authorize Spinnaker to access the AWS Secrets Manager&lt;/h2>
&lt;p>Remember to run the Operator and Spinnaker&lt;sup>TM&lt;/sup> services with IAM roles that allow them to read the keys stored in the AWS Secrets Manager. The following example policy enables access to the AWS Secrets Manger and the KMS store:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-json" data-lang="json">&lt;span style="display:flex;">&lt;span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Version&amp;#34;&lt;/span>: &lt;span style="color:#f1fa8c">&amp;#34;2012-10-17&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Statement&amp;#34;&lt;/span>: [
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Sid&amp;#34;&lt;/span>: &lt;span style="color:#f1fa8c">&amp;#34;VisualEditor0&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Effect&amp;#34;&lt;/span>: &lt;span style="color:#f1fa8c">&amp;#34;Allow&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Action&amp;#34;&lt;/span>: [
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f1fa8c">&amp;#34;kms:ListKeys&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f1fa8c">&amp;#34;kms:ListAliases&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f1fa8c">&amp;#34;kms:DescribeKey&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ],
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Resource&amp;#34;&lt;/span>: &lt;span style="color:#f1fa8c">&amp;#34;*&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> },
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Sid&amp;#34;&lt;/span>: &lt;span style="color:#f1fa8c">&amp;#34;VisualEditor1&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Effect&amp;#34;&lt;/span>: &lt;span style="color:#f1fa8c">&amp;#34;Allow&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Action&amp;#34;&lt;/span>: [
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f1fa8c">&amp;#34;secretsmanager:GetSecretValue&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f1fa8c">&amp;#34;secretsmanager:ListSecretVersionIds&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f1fa8c">&amp;#34;secretsmanager:ListSecrets&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ],
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Resource&amp;#34;&lt;/span>: &lt;span style="color:#f1fa8c">&amp;#34;*&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;Condition&amp;#34;&lt;/span>: {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;ForAnyValue:StringEquals&amp;#34;&lt;/span>: {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">&amp;#34;secretsmanager:VersionStage&amp;#34;&lt;/span>: &lt;span style="color:#f1fa8c">&amp;#34;AWSCURRENT&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="referencing-secrets-stored-in-aws-secrets-manager">Referencing secrets stored in AWS Secrets Manager&lt;/h2>
&lt;p>You can reference a KeyStore or KeyStore password stored in AWS Secrets Manager. Based on which type of secret you want to reference, use one of the following formats:&lt;/p>
&lt;p>&lt;strong>Keystore&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">keyStore&lt;/span>: encryptedFile:secrets-manager!r:&amp;lt;some region&amp;gt;!s:&amp;lt;secret name&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Keystore password&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ff79c6">keyStorePassword&lt;/span>: encrypted:secrets-manager!r:&amp;lt;some region&amp;gt;!s:&amp;lt;secret name&amp;gt;!k:some-key
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>&lt;code>encryptedFile&lt;/code> or &lt;code>encrypted&lt;/code> - &lt;strong>Required&lt;/strong>. Indicates that this is an encrypted file or an encrypted string, respectively.&lt;/li>
&lt;li>&lt;code>secrets-manager&lt;/code> - &lt;strong>Required&lt;/strong>. Indicates that secrets are stored in AWS Secrets Manager&lt;/li>
&lt;li>&lt;code>!&lt;/code> - &lt;strong>Required&lt;/strong>. Delimiter between parameters.&lt;/li>
&lt;li>&lt;code>r:&amp;lt;AWS region&amp;gt;&lt;/code> - &lt;strong>Required&lt;/strong>. The AWS region your secret is stored in. For example, use &lt;code>r:us-west-2&lt;/code> for a secret stored in the &lt;code>us-west-2&lt;/code> region.&lt;/li>
&lt;li>&lt;code>s:&amp;lt;Secret name&amp;gt;&lt;/code> - &lt;strong>Required&lt;/strong>. The name of the secret stored in AWS Secrets Manager&lt;/li>
&lt;li>&lt;code>k&amp;lt;some-key&amp;gt;&lt;/code> - &lt;strong>Required&lt;/strong> for encrypted strings. The Secret key. Omit for KeyStores.&lt;/li>
&lt;/ul>
&lt;p>For example, the following example references a KeyStore stored in &lt;code>us-west-2&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>encryptedFile:secrets-manager!r:us-west-2!s:dev--cert
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item></channel></rss>