Any advise on how to get this working?
It looks like drone sees that gitea k8s service is listening on port 3000, but to access gitea, it needs to go over port 80 to hit the ingress into the pod.
Error:
Initialized empty Git repository in /drone/src/.git/
2 + git fetch origin +refs/heads/master:
3 fatal: unable to access ‘http://gitea.example.com:3000/midacts/test.git/’: Failed to connect to gitea.example.com port 3000: Connection refused
gitea k8s deploy:
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitea
namespace: git
labels:
app: gitea
spec:
replicas: 1
selector:
matchLabels:
app: gitea
template:
metadata:
labels:
app: gitea
spec:
containers:
- name: gitea
image: gitea/gitea:latest
ports:
- containerPort: 3000
name: gitea-http
- containerPort: 22
name: gitea-ssh
volumeMounts:
- mountPath: /data
name: gitea-data
volumes:
- name: gitea-data
hostPath:
path: /kube-data/gitea
type: Directory
---
kind: Service
apiVersion: v1
metadata:
name: gitea
namespace: git
spec:
selector:
app: gitea
ports:
- name: gitea-http
port: 3000
targetPort: gitea-http
- name: gitea-ssh
port: 2222
targetPort: gitea-ssh
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: gitea
namespace: git
annotations:
kubernetes.io/ingress.class: "traefik"
spec:
rules:
- host: gitea.example.com
http:
paths:
- path: /
backend:
serviceName: gitea
servicePort: 3000
- host: gitea.10.2.1.204.xip.io
http:
paths:
- path: /
backend:
serviceName: gitea
servicePort: 3000
drone deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: drone
namespace: git
labels:
app: drone
spec:
replicas: 1
selector:
matchLabels:
app: drone
template:
metadata:
labels:
app: drone
spec:
containers:
- name: drone
image: drone/drone:1
ports:
- containerPort: 80
name: http
env:
- name: DRONE_GITEA_SERVER
value: http://gitea.10.2.1.204.xip.io
- name: DRONE_GITEA_CLIENT_ID
value: xxx
- name: DRONE_GITEA_CLIENT_SECRET
value: xxx
- name: DRONE_RPC_SECRET
value: xxx
- name: DRONE_SERVER_HOST
value: drone.example.com
- name: DRONE_SERVER_PROTO
value: http
volumeMounts:
- mountPath: /data
name: drone-data
- name: runner
image: drone/drone-runner-kube:latest
ports:
- containerPort: 3000
env:
- name: DRONE_RPC_HOST
value: drone.git.svc.cluster.local
- name: DRONE_RPC_PROTO
value: http
- name: DRONE_RPC_SECRET
value: xxx
- name: DRONE_NAMESPACE_DEFAULT
value: git
volumes:
- name: drone-data
hostPath:
path: /kube-data/drone
type: Directory
---
kind: Service
apiVersion: v1
metadata:
name: drone
namespace: git
spec:
selector:
app: drone
ports:
- name: http
port: 80
targetPort: http
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: drone
namespace: git
annotations:
kubernetes.io/ingress.class: "traefik"
spec:
rules:
- host: drone.example.com
http:
paths:
- path: /
backend:
serviceName: drone
servicePort: 80
- host: drone.10.2.1.240.xip.io
http:
paths:
- path: /
backend:
serviceName: drone
servicePort: 80
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: git
name: drone
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- delete
- apiGroups:
- ""
resources:
- pods
- pods/log
verbs:
- get
- create
- delete
- list
- watch
- update
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: drone
namespace: git
subjects:
- kind: ServiceAccount
name: default
namespace: git
roleRef:
kind: Role
name: drone
apiGroup: rbac.authorization.k8s.io