Skip to content

Instantly share code, notes, and snippets.

@brunomacf
Created April 8, 2018 00:28
Show Gist options
  • Save brunomacf/79626bc5c417e8389cb36447c02a81c6 to your computer and use it in GitHub Desktop.
Save brunomacf/79626bc5c417e8389cb36447c02a81c6 to your computer and use it in GitHub Desktop.
kube-test kubernetes.tpl.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: _APP_NAME_
labels:
app: _APP_NAME_
spec:
replicas: 1
selector:
matchLabels:
app: _APP_NAME_
# Pod template
template:
metadata:
labels:
app: _APP_NAME_
spec:
containers:
- name: test
image: registry.gitlab.com/brunomacf/kube-test:_VERSION_
imagePullPolicy: Always
ports:
- containerPort: 80
imagePullSecrets:
- name: gitlab-registry
---
apiVersion: v1
kind: Service
metadata:
name: _APP_NAME_
labels:
app: _APP_NAME_
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
selector:
app: _APP_NAME_
@daviddsp
Copy link

Great tutorial, thanks for sharing, though I am struggling to get the Deploy stage to run. I get the following error:
@brunomacf
$ printf “apiVersion: v1\nkind: Secret\n$(kubectl create secret docker-registry gitlab-registry — docker-server=$CI_REGISTRY — docker-username=$CI_REGISTRY_USER — docker-password=$CI_REGISTRY_PASSWORD — docker-email=$GITLAB_USER_EMAIL -o yaml — dry-run)” | kubectl apply -f -
error: unable to recognize “STDIN”:

I saw that someone else had the exact same issue so wondering if GitLab has updated something since this tutorial was written? Any ideas what it could be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment