<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sZma5a</title>
    <description>The latest articles on DEV Community by sZma5a (@szma5a).</description>
    <link>https://dev.to/szma5a</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1296558%2F11de7221-6645-49c6-a585-c21e48b1c74e.jpg</url>
      <title>DEV Community: sZma5a</title>
      <link>https://dev.to/szma5a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/szma5a"/>
    <language>en</language>
    <item>
      <title>Configuration and Troubleshooting of Using Akeyless with External Secret Operator</title>
      <dc:creator>sZma5a</dc:creator>
      <pubDate>Mon, 29 Jul 2024 17:24:19 +0000</pubDate>
      <link>https://dev.to/szma5a/configuration-and-troubleshooting-of-using-akeyless-with-external-secret-operator-35ei</link>
      <guid>https://dev.to/szma5a/configuration-and-troubleshooting-of-using-akeyless-with-external-secret-operator-35ei</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Everyone, how do you manage secrets in your home cluster?&lt;br&gt;
Since individual use doesn't warrant spending too much money, I was hesitant about using GCP or AWS Secret Manager. Then, I came across an interesting service in the &lt;a href="https://external-secrets.io/latest/provider/akeyless/" rel="noopener noreferrer"&gt;External Secret Operator Provider&lt;/a&gt; and decided to give it a try.&lt;br&gt;
The Akeyless service we'll discuss today has a large &lt;a href="https://www.akeyless.io/pricing/" rel="noopener noreferrer"&gt;free tier&lt;/a&gt;, making it more accessible for individual development compared to something like HashiCorp Vault.&lt;br&gt;
5 Clients&lt;br&gt;
2,000 Static Secrets&lt;/p&gt;
&lt;h2&gt;
  
  
  External Secret Operator
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://external-secrets.io/latest/" rel="noopener noreferrer"&gt;External Secret Operator&lt;/a&gt; is a handy tool that creates secrets from an external secret manager. This means you don't need to leave credential information in your manifests and can manage everything centrally. You can configure the secret manager information to be used on a cluster-wide or namespace basis, allowing for flexible separation, whether for multi-tenant or single-tenant use.&lt;/p&gt;
&lt;h2&gt;
  
  
  Akeyless
&lt;/h2&gt;

&lt;p&gt;Akeyless is a secret manager SaaS provided by an Israeli company. It has a patented technology called &lt;a href="https://docs.akeyless.io/docs/dfc" rel="noopener noreferrer"&gt;DFC&lt;/a&gt; for managing private keys, offering high security by managing key fragments across different clouds and regions. It not only has basic features like key rotation but also robust &lt;a href="https://docs.akeyless.io/docs/kubernetes-plugins" rel="noopener noreferrer"&gt;integration with Kubernetes&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;
  
  
  Setup
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lRMeUWjW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://storage.googleapis.com/zenn-user-upload/9fe5183d5dd0-20240728.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lRMeUWjW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://storage.googleapis.com/zenn-user-upload/9fe5183d5dd0-20240728.png" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Image: Akeyless + External Secret Operator&lt;/em&gt;&lt;br&gt;
&lt;a href="https://docs.akeyless.io/docs/external-secret-operator" rel="noopener noreferrer"&gt;https://docs.akeyless.io/docs/external-secret-operator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Akeyless documentation includes instructions for installing the External Secret Operator, so you can follow it step by step. I used API keys for integration, issuing an API key from Users &amp;amp; Auth Methods in the dashboard and configuring it as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;accessId&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;p-XXXX"&lt;/span&gt; &lt;span class="c1"&gt;# AccessID&lt;/span&gt;
&lt;span class="na"&gt;accessType&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api_key&lt;/span&gt;
&lt;span class="na"&gt;accessTypeParam&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;api_key&amp;gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, I attached a role to the issued authentication information in Akeyless to allow access to the secret information and performed &lt;a href="https://faun.pub/akeyless-secret-management-with-external-secrets-operator-in-local-kubernetes-b30ae309d5f9" rel="noopener noreferrer"&gt;role addition and linking&lt;/a&gt;.&lt;br&gt;
As a side note, Akeyless has a Personal directory for storing personal credential information, so be careful to put information in the right place depending on the use case. In this case, since I wanted to access it regardless of the user, I created and managed a directory directly under Items.&lt;/p&gt;
&lt;h1&gt;
  
  
  Issues Encountered
&lt;/h1&gt;

&lt;p&gt;While handling credential information, I restricted the IP for the API key, which led to access issues. Upon checking the audit logs, I noticed access from unfamiliar IP addresses, suggesting that requests might be proxied somewhere and the client's IP was not being conveyed correctly. To solve this, I accessed Akeyless via the Akeyless Gateway from the External Secret Operator.&lt;/p&gt;
&lt;h2&gt;
  
  
  Installing Akeyless Gateway
&lt;/h2&gt;

&lt;p&gt;This is also installed using Helm. You can check the steps in the documentation or the Gateway section in the dashboard and proceed accordingly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6wp8fspy530q3m6v1o1e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6wp8fspy530q3m6v1o1e.png" alt="Image description" width="800" height="521"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.akeyless.io/docs/gateway-k8s" rel="noopener noreferrer"&gt;https://docs.akeyless.io/docs/gateway-k8s&lt;/a&gt;&lt;br&gt;
Although the values.yaml file usually includes authentication information for building, this time I output it with helm template and rewrote the Secret to build it without including authentication information, as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Secret&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt; name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;akeyless-gw-conf-secret&lt;/span&gt;
&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Opaque&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt; admin-access-id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;
&lt;span class="na"&gt; admin-access-key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;
&lt;span class="s"&gt; - -&lt;/span&gt;
&lt;span class="s"&gt;…&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, by &lt;a href="https://docs.akeyless.io/docs/external-secret-operator#:~:text=If%20you%20use%20a%20customer%20fragment%2C%20define%20the%20value%20of%20akeylessGWApiURL%20as%20the%20URL%20of%20your%20Akeyless%20Gateway%20in%20the%20following%20format%3A%20https%3A//your_akeyless_gw%3A8080/v2." rel="noopener noreferrer"&gt;setting the URL of the SecretStore&lt;/a&gt; to the Gateway, you can connect. Keep the authentication information such as accessID and accessType as they are.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;external-secrets.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterSecretStore&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt; name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;akeyless-cluster-secret-store&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt; provider&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt; akeyless&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="s"&gt; # URL of your akeyless API&lt;/span&gt;
&lt;span class="na"&gt; akeylessGWApiURL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://akeyless-gw-akeyless-api-gateway.akeyless-gateway.svc.cluster.local:8080/v2"&lt;/span&gt;
&lt;span class="na"&gt; authSecretRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="s"&gt;…&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;This time, I introduced a method to manage secret information externally while applying IP restrictions using the Akeyless Gateway. Originally, this Gateway seems to be intended for operation without keys, so I will look for a way to avoid using the API key, which is still left as a Secret.&lt;/p&gt;

&lt;h1&gt;
  
  
  References
&lt;/h1&gt;

&lt;h3&gt;
  
  
  External Secret Operator + Akeyless
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.akeyless.io/docs/external-secret-operator" rel="noopener noreferrer"&gt;https://docs.akeyless.io/docs/external-secret-operator&lt;/a&gt;&lt;br&gt;
&lt;a href="https://faun.pub/akeyless-secret-management-with-external-secrets-operator-in-local-kubernetes-b30ae309d5f9" rel="noopener noreferrer"&gt;https://faun.pub/akeyless-secret-management-with-external-secrets-operator-in-local-kubernetes-b30ae309d5f9&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Gateway
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.akeyless.io/docs/api-gw" rel="noopener noreferrer"&gt;https://docs.akeyless.io/docs/api-gw&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.akeyless.io/docs/gateway-k8s" rel="noopener noreferrer"&gt;https://docs.akeyless.io/docs/gateway-k8s&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
