Created
January 24, 2019 13:29
-
-
Save arsham/e692de6f6850d5da79660afbe84215f9 to your computer and use it in GitHub Desktop.
Login to #docker hub in #kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker login | |
cat <<EOF | kubectl apply -f - | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: registrypullsecret | |
data: | |
.dockerconfigjson: "$(cat ~/.docker/config.json | base64 | tr -d '\n')" | |
type: kubernetes.io/dockerconfigjson | |
EOF | |
# To test: | |
cat <<EOF | kubectl create -f - | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: logintest | |
spec: | |
containers: | |
- name: logintest | |
image: vervesearch/blinds:latest | |
imagePullPolicy: Always | |
command: [ "echo", "SUCCESS" ] | |
imagePullSecrets: | |
- name: registrypullsecret | |
EOF | |
kubectl logs logintest | |
kubectl delete po logintest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment