title: How to refresh AWS authentication token for EKS cluster
body: <p>I am authenticating via the following</p>
  <p>First I authenticate into AWS via the following</p>
  <pre><code>aws ecr get-login-password --region cn-north-1 | docker login --username AWS --password-stdin xxxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn
  </code></pre>
  <p>Then I created the <code>regcred</code> file that I reference in my deployment config</p>
  <pre><code>kubectl create secret generic regcred --from-file=.dockerconfigjson=/home/noobskie/.docker/config.json --type=kubernetes.io/dockerconfigjson
  </code></pre>
  <p>So this was working fine the first 12 hours but now that the AWS token has expired I am having trouble figuring out how to properly refresh it. I have rerun the first command but it doesn't work.</p>
  <p>the error I get is</p>
  <pre><code>Error response from daemon: pull access denied for xxxxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn/baopals, repository does not exist or may require 'docker login': denied: Your authorization token has expired. Reauthenticate and try again.
  </code></pre>
  <p><strong>EDIT</strong></p>
  <p>I have just discovered that I can just reconfigure with the following command but I am curious if this is the correct way to handle it and if there are any other AWS ways offered.</p>
  <pre><code>kubectl create secret generic regcred --from-file=.dockerconfigjson=/home/noobskie/.docker/config.json --dry-run -o yaml | kubectl apply -f -
  </code></pre>