It requires many step and there is no complete guide available. Hence, this tutorial exist.
Step 1: Create DigitalOcean Kubernetes
It's fairly straight forward process. Once it done, click on Download config file
button. It will download .yaml
file.
Step 2: Install kubectl
- Download kubectl.exe
More information: https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-windows
- Open
C:\Users\<windows-user>\
and createkubectl
folder - Copy
kubectl.exe
inC:\Users\<windows-user>\kubectl
- Press Windows + R keys together, type the command "ysdm.cpl" in the Run dialog box and press Enter.
- Click on
Advanced
>Environment Variables
> UnderSystem Variables
> SelectPath
> ClickEdit
> ClickNew
> EnterC:\Users\<windows-user>\kubectl
- Open
Command Prompt
and typekubectl
and press enter. If you get message instead error that meankubectl
is configured.
Step 3: Install awk
Download and install awk
Similary like previus example, add new path to
Environment Variables
and Path will beC:\Program Files (x86)\GnuWin32\bin
Open
Command Prompt
and typeawk
and press enter. If you get message instead error that meanawk
is configured.
Step 4: Install doctl
Download and install windows version from doctl
Create DigitalOcean (DO)
Token
. Login toDO > Click API > Generate New Token
. Copy token.Open
C:\Users\<windows-user>\kubectl
inCommand Prompt
and rundoctl auth init
command. It will ask you theToken
to enter.Run the command provided in DO Screenshot
Step 5: Create gitlab-setup.yml
- Open
C:\Users\<windows-user>\kubectl
and creategitlab-setup.yml
file with following content:
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: gitlab-cluster-admin
subjects:
- kind: ServiceAccount
name: gitlab
namespace: default
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
Open
cmd
and typecd C:\Users\<windows-user>\kubectl
Type
kubectl apply -f gitlab-setup.yml
and press enter;
Step 6: Get Gitlab Kubernetes cluster details
Reference: https://www.youtube.com/watch?v=7ycuOLa5mtM
App URL:
- Run following command to get
APP URL
:
kubectl cluster-info | findstr "Kubernetes master" | awk "/http/ {print $NF}"
- Get
secrete
, run
kubectl get secrets --all-namespaces|awk "/gitlab-token/ {print $2}"
Note the text echo/printed
on the screen. Let's call this text as $SECRETE
- Get
CA Certificate
, run following command:
kubectl get secret $SECRETE -o jsonpath="{['data']['ca\.crt']}"
Note: replace $SECRETE
with the actual text which was printed.
This command will give you a string/text. Copy that text and paste at https://www.base64decode.org/
then click on decode, this give you the CERTIFICATE
simloar to follow:
-----BEGIN CERTIFICATE-----
MIIDJzCCAg+gAwIBAgICBnUwDQYJKoZIhvcNAQELBQAwMzEVMBMGA1UEChMMRGln
....
....
DD/JYjdMdAewoEXZlXPAJIS+eQjXi6AWbLYzBTRHc55GjJoxugWYF0xrTg==
-----END CERTIFICATE-----
- Get
Service Token
, run following command:
kubectl get secret $SECRETE -o jsonpath="{['data']['token']}"
Note: replace $SECRETE
with the actual text which was printed.
This command will give you a string/text. Copy that text and paste at https://www.base64decode.org/
then click on decode, this give you the CERTIFICATE
simloar to follow:
eyJhbGciOi......66GmIE4KH4OHr44Py-4HA
Step 4: Configure Gitlab Kubernetes
- Visit:
<gitlab-url>/admin/clusters
- Enter the details that you collected in
previous
steps and Click on save - In
Helm Tiller
, clickInstall
- Then, in
Ingress
, clickInstall
. After install it will give an IP and an URL inBase domain
, copy this URL and enter inBase domain
input and click save. - In
Cert-Manager
, clickInstall
. - In
GitLab Runner
, clickInstall
.
Step 5: Test Project
Visit
<gitlab-url>/admin/runners
, here you will see a newrunner
. You can edit the runner and removetags
so that it can pick all the CI jobs. You can also assign project to this runner.Create New Project.
Auto DevOps will automatically kick and run the pipelines.
Top comments (0)