Gitea and DroneCI setup on minikube

Hey guys, fairly new to kubernetes and trying to setup a CI pipeline locally. Want to practice integrating droneCI with a locally running Gitea instance on minikube. I have a Gitea instance with an OAUTH token created.

I have also deployed droneCI successfully with the following configuration:-

Secrets File

apiVersion: v1
kind: Secret
metadata:
name: drone-server-secret
type: Opaque
stringData:
  DRONE_GITEA_CLIENT_ID: 4c9388a6-a43e-4dd2-bfb7-ac6759838fee    #Get this from Gitea OAUTH
  DRONE_GITEA_CLIENT_SECRET: Sizx_yaQK7SIvHQpBvZLnNqUs9_jcYihZw9o2-229rs=  #Get this from Gitea OAUTH
  DRONE_RPC_SECRET: 394a8201ea2fb490547404df5f7135fa           #openssl rand -hex 16
  DRONE_DATABASE_DATASOURCE: postgres://postgresadmin:admin123@postgres:5432/postgresdb?sslmode=disable
  DRONE_USER_CREATE: username:gitea_admin,admin:true
  DRONE_SERVER_HOST: drone.example.com
  DRONE_GITEA_SERVER: http://gitea-charts-0.gitea.svc.cluster.local:3000/ 

Drone Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: drone-server
  labels:
    app: drone-server
  annotations:
spec:
  selector:
     matchLabels:
      app: drone-server
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    template:
    metadata:
      labels:
        app: drone-server
    spec:
      containers:
      - name: drone-server
        image: drone/drone:1.6.5
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        - containerPort: 443
        env:
        - name: DRONE_USER_CREATE 
          valueFrom:
            secretKeyRef:
              name: drone-server-secret
              key: DRONE_USER_CREATE
        - name: DRONE_DATABASE_DRIVER
          value: postgres
        - name: DRONE_DATABASE_DATASOURCE 
          valueFrom:
            secretKeyRef:
              name: drone-server-secret
              key: DRONE_DATABASE_DATASOURCE
        - name: DRONE_SERVER_PROTO
          value: http
        - name: DRONE_GITEA_SERVER
          valueFrom:
            secretKeyRef:
              name: drone-server-secret
              key: DRONE_SERVER_HOST
        - name: DRONE_SERVER_HOST 
          valueFrom:
            secretKeyRef:
              name: drone-server-secret
              key: DRONE_SERVER_HOST
        - name: DRONE_GITEA_CLIENT_ID 
          valueFrom:
            secretKeyRef:
              name: drone-server-secret
              key: DRONE_GITEA_CLIENT_ID
        - name: DRONE_GITEA_CLIENT_SECRET 
          valueFrom:
            secretKeyRef:
              name: drone-server-secret
              key: DRONE_GITEA_CLIENT_SECRET
        - name: DRONE_RPC_SECRET 
          valueFrom:
            secretKeyRef:
              name: drone-server-secret
              key: DRONE_RPC_SECRET

After deploying I have checked the logs of the server pod -

{"level":"info","msg":"main: internal scheduler enabled","time":"2021-07-11T15:54:58Z"}
{"admin":true,"level":"info","login":"gitea_admin","machine":false,"msg":"bootstrap: account created","time":"2021-07-11T15:54:58Z","token":"ajbADBMpSMcXyN5ILViNPOwQPDbstfTD"}
{"acme":false,"host":"drone.example.com","level":"info","msg":"starting the http server","port":":80","proto":"http","time":"2021-07-11T15:54:58Z","url":"http://drone.example.com"}
{"interval":"30m0s","level":"info","msg":"starting the cron scheduler","time":"2021-07-11T15:54:58Z"}

I then port-forward the droneserver pod to 8000:80. When I go to localhost:8000, the server does respond but the webpage is blank. Not sure if it is an authorization problem. Any ideas what the problem might be?

@pawanjot_singh ,

I can see you are using drone.example.com as your DRONE_SERVER_HOST, Ideally it should be same as the host you configured on gitea, could you please try to update and test.

@csgit thanks for you reply but that doesn’t work. I think it is because the url in the Gitea (and hence the drone host) server is required to be public, but I am running drone locally on minikube. That’s why currently in the url, I have listed in the format pod.namespace.svc.cluster.local so that gitea can communicate with drone which is inside the same cluster but different namespaces.

Do you have more information?
I use

DRONE_GITEA_SERVER: http://gitea-http.gitea.svc.cluster.local:3000
DRONE_GITEA_SERVER: http://gitea-http.gitea.svc.cluster.local
DRONE_GITEA_SERVER: http://gitea.x.cool

Respectively is:
#2 This website cannot be accessed
#3 Post “http://gitea.x.cool/login/oauth/access_token” : dial TCP: lookup gitea. X.c ool on 10.152.183.10:53: no to the host

ps, I have set a ingress with host in cluster

modify coredns comfigmap to solve this

rewrite stop {
    name regex (.*)\.x\.cool envoy.projectcontour.svc.cluster.local
}