System Reboot Engineer System Reboot Engineer
首页
运维
编程

小布江

首页
运维
编程
  • Kubernetes

  • 日常

  • Prometheus

  • Ci

    • Jenkins-ci
    • Argocd
    • 运维
    • Ci
    小布江
    2025-03-11
    目录

    Argocd


    Argo CD (opens new window) 是针对 Kubernetes 的声明式 GitOps 持续交付工具。


    # 快速入门安装
    wget -O argocd.yaml https://raw.githubusercontent.com/argoproj/argo-cd/v2.8.4/manifests/install.yaml
    sed -i 's|quay.io/argoproj/argocd:v2.8.4|registry.cn-hangzhou.aliyuncs.com/s-ops/argocd:v2.8.4|g' argocd.yaml
    sed -i 's|ghcr.io/dexidp/dex:v2.37.0|registry.cn-hangzhou.aliyuncs.com/s-ops/dex:v2.37.0|g' argocd.yaml
    sed -i 's|redis:7.0.11-alpine|registry.cn-hangzhou.aliyuncs.com/s-ops/redis:7.0.11-alpine|g' argocd.yaml
    sed -i 's/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g' argocd.yaml
    kubectl create ns argocd
    kubectl apply -f argocd.yaml -n argocd
    
    1
    2
    3
    4
    5
    6
    7

    我们可以通过配置 Ingress 的方式来对外暴露服务,其他 Ingress 控制器的配置可以参考官方文档 https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/ 进行配置,本案例使用非http的方式。


    需要在禁用 TLS 的情况下运行 APIServer,编辑 YAML中argocd-server 这个 Deployment 以将--insecure 标志添加到 argocd-server 命令,或者简单地在 argocd-cmd-params-cm ConfigMap中设置 server.insecure: "true" 即可:

    image-20250320162325204

    cat > http-argocd-ingress.yaml <<EOF
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: argocd
      namespace: argocd
    spec:
      ingressClassName: nginx
      rules:
        - http:
            paths:
              - path: /
                pathType: Prefix
                backend:
                  service:
                    name: argocd-server
                    port:
                      name: http
          host: argocd.tbchip.com
    EOF
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20

    当然我们也可以通过NodePort的方式来访问

    kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'
    
    1

    默认情况下 admin 帐号的初始密码是自动生成的,会以明文的形式存储在 Argo CD 安装的命名空间中名为 argocd-initial-admin-secret 的 Secret 对象下的 password 字段下,我们可以用下面的命令来获

    kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo
    
    1

    Argocd配置认证,我们的资源文件都在ops-repo仓库,我们这边演示http的方式认证,或者打开URL地址http://argocd.tbchip.com/settings/repos?addRepo=true

    image-20250314132722525

    #Argocd
    上次更新: 2025/04/25, 03:40:17
    Jenkins-ci

    ← Jenkins-ci

    最近更新
    01
    Harbor复制镜像
    04-15
    02
    CPU亲和
    04-10
    03
    开启telnet登录
    04-09
    更多文章>
    Theme by Vdoing
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式