--
notes
- install k3s (quick start) https://docs.k3s.io/quick-start
curl -sfL https://get.k3s.io | sh -
-
install heml (From Script) https://helm.sh/docs/intro/install
-
if just for testing, set below env variable for helm
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
- follow section in below link
https://docs.gitlab.com/ee/user/clusters/agent/install/index.html#create-an-agent-configuration-file
-
created empty repo https://gitlab.com/pangyuteng/hola-gitlab-cicd
-
"Operate"->"Kubernetes clusters"->"Connect a cluster"
-
"Option 2: Create and register an agent with the UI".
-
agent name: "hola"
-
"Create and register"
-
run the provided helm commands
-
- create another new repo via "Create from template"--> pick "GitLab Cluster Management"-->"Use template"
name hola-cluster-management
cloned from https://gitlab.com/gitlab-org/project-templates/cluster-management
commit fe85a1cd
-
make some changes to files.
-
get runner token and add as cicd variable
GITLAB_RUNNER_TOKEN
(masked!)tags
hola,kubernetes
check
run untagged jobs
description
hola-gitlab-runner
https://gitlab.com/pangyuteng/hola-cluster-management/-/runners/new
- in repo create
.gitlab/agents/hola/config.yaml
to authorize agent access to project.
ci_access:
projects:
- id: pangyuteng/hola-cluster-management
- the initial Build Pipeline, you will need to use instance runner or create a runner.
https://gitlab.com/pangyuteng/hola-cluster-management/-/pipelines
-
monitor build pipelin and click play to enable the second step in the pipeline.
-
create new repo to testout running a cicd job with the runner in the cluster.
https://gitlab.com/pangyuteng/hola-app-in-cluster#
- enable "hola-gitlab-runner" as runnner in settings->cicd
https://gitlab.com/pangyuteng/hola-app-in-cluster/-/settings/ci_cd#js-runners-settings
--
public:
sample "gitlab agent" repo to access kube cluster:
https://gitlab.com/pangyuteng/hola-gitlab-cicd
sample "cluster management" repo to deploying the runner:
https://gitlab.com/pangyuteng/hola-cluster-management
sample "hello-world" repo with cicd:
https://gitlab.com/pangyuteng/hola-app-in-cluster
--
old notes.
- create gitlab agent with kube cluster.
- "install gitlab agent" (create repo, then follow belo, via Operate->Kubernetes cluster, run helm commands to create gitlab agent which lets gitlab access your cluster")
https://docs.gitlab.com/ee/user/clusters/agent/install/
https://docs.gitlab.com/ee/user/clusters/agent/ci_cd_workflow.html#use-gitlab-cicd-with-your-cluster
- clone repo "cluster management project template" for spinning up the gitlab runner.
public:
https://gitlab.com/pangyuteng/hola-gitlab-cicd
https://gitlab.com/pangyuteng/hola-cluster-management
https://gitlab.com/pangyuteng/hola-app-in-cluster
private:
sample "gitlab agent" repo to access kube cluster: https://gitlab.com/pangyuteng/hello-k3s-gitlab-agent/-/tree/main?ref_type=heads
sample "cluster management" repo to deploying the runner: https://gitlab.com/pangyuteng/hello-gitlab-cluster-management
sample "hello-world" repo with cicd: https://gitlab.com/pangyuteng/hello-k3s-flask-app