<p>I have one of my images private and was getting access with the imagePullSecrets: up until now but after enabling 2FA for docker-hub Kubernetes can no longer pull my image, how do I solve this?</p>
<p>currently using:
apiVersion: apps/v1
kind: Deployment</p>

Alex Skotner
<p>You need to create a new imagePullSecret and use it in your manifests.</p>
<p>Login with your username and personal access token. this will update your ~/.docker/config.json</p>
<pre><code>docker login registry.example.com -u &lt;your_username&gt; -p &lt;your_personal_access_token&gt;
</code></pre>
<p>Create your imagePullSecret using the updated config.json</p>
<pre><code>kubectl create secret generic regcred \
    --from-file=.dockerconfigjson=&lt;path/to/.docker/config.json&gt; \
    --type=kubernetes.io/dockerconfigjson
</code></pre>
<p>Update your deployment,statefulset,pod,jobs to use this new secret</p>
<p>Alternatively, if you want to make this imagePullSecret default for a namespace. Just make sure that the secret exists in that namespace. Secret may have same name in multiple namespaces as it is a namespaced object.</p>
<pre><code>kubectl patch serviceaccount default -p '{&quot;imagePullSecrets&quot;: [{&quot;name&quot;: &quot;regcred&quot;}]}'
</code></pre>
