1. 安装helm3
    wget http://xxxx
    mv helm /usr/local/bin
  2. 安装gitlab-runner到k8s
    helm repo add gitlab https://charts.gitlab.io
    编辑values.yaml
    imagePullPolicy: IfNotPresent
    gitlabUrl: "http://192.168.222.130:9980"
    runnerRegistrationToken: "131yjJMtno82us1B3C5t"
    concurrent: 10
    checkInterval: 30
    logLevel: info
    
    rbac:
      create: true
    
    metrics:
      enabled: false
    
    runners:
      config: |
        [[runners]]
          clone_url = "http://192.168.222.130:9980"
          [runners.kubernetes]
            namespace = "{{.Release.Namespace}}"
            image = "ubuntu:20.04"
            [[runners.kubernetes.volumes.host_path]]
                name = "docker"
                mount_path = "/var/run/docker.sock"
                host_path = "/var/run/docker.sock"
      privileged: "true"
      name: kubernetes-runner
      tags: "kubernetes,runner"
    
    securityContext:
      runAsUser: 100
      fsGroup: 65533
    
    创建命名空间
    kubectl create ns kubeops
    安装
    helm install --namespace kube-ops gitlab-ops-runner -f values.yaml gitlab/gitlab-runner
  3. 编写.gitlab-ci.yml测试
    image: ubuntu
    
    stages:
      - build
    
    build:
      stage: build
      tags:
        - kubernetes
      script:
        - echo "123"
    
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐