<p>I was following a guide to connect a database to kubernetes:
<a href="https://itnext.io/basic-postgres-database-in-kubernetes-23c7834d91ef" rel="nofollow noreferrer">https://itnext.io/basic-postgres-database-in-kubernetes-23c7834d91ef</a></p>
<p>after installing Kubernetes (minikube) on Windows 10 64 bit:
<a href="https://minikube.sigs.k8s.io/docs/start/" rel="nofollow noreferrer">https://minikube.sigs.k8s.io/docs/start/</a></p>
<p>I am encountering an issue with 'base64' where the DB is trying to connect and store the password.  As PowerShell doesn't recognise it. I was wondering if anyone has any ideas how I could either fix this and still use windows or an alternative means that would enable me to continue with the rest of the guide?</p>
<p>Error Code:</p>
<pre><code>base64 : The term 'base64' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:131
+ ... postgresql -o jsonpath=&quot;{.data.postgresql-password}&quot; | base64 --decod ...
+                                                            ~~~~~~
    + CategoryInfo          : ObjectNotFound: (base64:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

export : The term 'export' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ export POSTGRES_PASSWORD=$(kubectl get secret --namespace default pos ...
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (export:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
</code></pre>
<p><a href="https://i.stack.imgur.com/veiUJ.png" rel="nofollow noreferrer">Windows Powershell Error message</a></p>

Tanik
<p>The <code>base64</code> cli found in Mac OS and some *nix distros is not available on Windows.</p>
<p>You <em>could</em> write a small function named <code>base64</code> that mimics the behavior of the <code>base64</code> unix tool though:</p>
<pre><code>function base64 {
  # enumerate all pipeline input
  $input |ForEach-Object {
    if($MyInvocation.UnboundArguments -contains '--decode'){
      # caller supplied `--decode`, so decode 
      $bytes = [convert]::FromBase64String($_)
      [System.Text.Encoding]::ASCII.GetString($bytes)
    } else {
      # default mode, encode ascii text as base64
      $bytes = [System.Text.Encoding]::ASCII.GetBytes($_)
      [convert]::ToBase64String($bytes)
    }
  }
}
</code></pre>
<p>This should work as a drop-in replacement for conversion between ASCII/UTF7 text and base64:</p>
<pre><code>PS ~&gt; 'Hello, World!' |base64 --encode
SGVsbG8sIFdvcmxkIQ==
PS ~&gt; 'Hello, World!' |base64 --encode |base64 --decode
Hello, World!
</code></pre>
<hr />
<p>To use with your existing scripts, simple dot-source a script with the function definition in your shell before executing the others:</p>
<pre><code>PS ~&gt; . .\path\to\base64.ps1
</code></pre>
<p>The above will work from a script as well. If you have a multi-line paste-aware shell (Windows' default Console Host with PSReadLine should be okay), you can also just paste the function definition directly into the prompt :)</p>
