Skip to content

Instantly share code, notes, and snippets.

@vonglasow
Last active November 28, 2017 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vonglasow/efcf09821b6d86b1c0b85bbbbc695476 to your computer and use it in GitHub Desktop.
Save vonglasow/efcf09821b6d86b1c0b85bbbbc695476 to your computer and use it in GitHub Desktop.
keel.sh private registry access

Generate private registry configuration and apply deployment

Edit dockercfg file to add your credentials and configure your private registry then edit the example-deployment.yaml file to change url image to access to your private registry. Edit the keel-deployment.yaml file to choose the project.

Run:

make install

To clean run:

make clean
{
"gcr.myproject.com": {
"auth": "tokenauth1"
},
"ucr.myproject.io": {
"auth": "tokenauth2"
}
}
# vim: set ts=2 sw=2 tw=0 et :
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
service: example
keel.sh/policy: all
keel.sh/trigger: poll
name: example
spec:
replicas: 1
minReadySeconds: 5
revisionHistoryLimit: 5
strategy:
# indicate which strategy we want for rolling update
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
creationTimestamp: null
labels:
service: example
spec:
containers:
- name: example
image: gcr.myproject.com/myproject/example:latest
ports:
- containerPort: 80
restartPolicy: Always
imagePullSecrets:
- name: private-registry
status: {}
# vim: set ts=2 sw=2 tw=0 et :
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kubernetes.io/service-account.name: keel
name: keel
namespace: kube-system
labels:
name: "keel"
spec:
replicas: 1
template:
metadata:
name: keel
labels:
app: keel
spec:
containers:
- image: karolisr/keel:0.4.7
imagePullPolicy: Always
env:
- name: POLL
value: "1"
- name: PUBSUB
value: "1"
- name: PROJECT_ID
value: "myprojetid"
name: keel
command: ["/bin/keel"]
ports:
- containerPort: 9300
livenessProbe:
httpGet:
path: /healthz
port: 9300
initialDelaySeconds: 30
timeoutSeconds: 10
install: registry.yaml
kubectl create -f registry.yaml
kubectl create -f example-deployment.yaml
kubectl create -f keel-deployment.yaml
registry.yaml:
bash ./registry-secret.sh > $@
clean: registry.yaml
kubectl delete -f registry.yaml
kubectl delete -f example-deployment.yaml
kubectl delete -f keel-deployment.yaml
.INTERMEDIATE: registry.yaml
#!/bin/bash
DOCKERFILE=$(cat dockercfg | base64 | tr -d '\n')
echo -e "apiVersion: v1
kind: Secret
metadata:
name: private-registry
data:
.dockercfg: $DOCKERFILE
type: kubernetes.io/dockercfg
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment