云原生--argocd 命令行

本文涉及的产品
容器服务 Serverless 版 ACK Serverless,317元额度 多规格
容器服务 Serverless 版 ACK Serverless,952元额度 多规格
简介: 云原生--argocd 命令行

前戏


在使用命令行的时候需要先登录

# 登录要指定 ip 和端口
[root@master1 ~]# argocd login 10.6.215.30:30495
WARNING: server certificate had error: x509: cannot validate certificate for 10.6.215.30 because it doesn't contain any IP SANs. Proceed insecurely (y/n)? y
Username: admin
Password:
'admin:login' logged in successfully
Context '10.6.215.30:30495' updated


命令行


查看所有的应用

# 查看所有的应用,不需要指定 ns,查询的是所有 ns 下的
[root@master1 k8s-yaml]# argocd app list
NAME   CLUSTER                         NAMESPACE  PROJECT  STATUS     HEALTH   SYNCPOLICY  CONDITIONS  REPO                                           PATH  TARGET
app01  https://kubernetes.default.svc  demo1      default  OutOfSync  Missing  <none>      <none>      https://gitee.com/zouzou_busy/devops_test.git  app
app02  https://kubernetes.default.svc  demo2      default  OutOfSync  Missing  <none>      <none>      https://gitee.com/zouzou_busy/devops_test.git  app   HEAD
app03  https://kubernetes.default.svc  demo3      default  OutOfSync  Missing  <none>      <none>      https://gitee.com/zouzou_busy/devops_test.git  app   HEAD

查看某一个应用

# 查看某一个应用
[root@master1 k8s-yaml]# argocd app get app01
Name:               app01
Project:            default
Server:             https://kubernetes.default.svc
Namespace:          demo1 # 应用所在的 ns
URL:                https://10.6.215.30:32382/applications/app01 # 应用所在的 UI 地址
Repo:               https://gitee.com/zouzou_busy/devops_test.git # 所同步的仓库地址
Target:
Path:               app # 仓库里的路径
SyncWindow:         Sync Allowed
Sync Policy:        <none> # 同步的策略
Sync Status:        OutOfSync from  (d7306f4) # 同步的状态
Health Status:      Missing # 健康状态
GROUP  KIND        NAMESPACE  NAME   STATUS     HEALTH   HOOK  MESSAGE
       Service     demo1      myapp  OutOfSync  Missing # 应用的状态
apps   Deployment  demo1      myapp  OutOfSync  Missing

同步某一个应用

# 同步 app01 的应用
[root@master1 k8s-yaml]# argocd app sync app01
TIMESTAMP                  GROUP        KIND   NAMESPACE                  NAME    STATUS    HEALTH        HOOK  MESSAGE
2022-08-18T21:40:18+08:00            Service       demo1                 myapp  OutOfSync  Missing
2022-08-18T21:40:18+08:00   apps  Deployment       demo1                 myapp  OutOfSync  Missing
2022-08-18T21:40:18+08:00            Service       demo1                 myapp    Synced  Healthy
2022-08-18T21:40:19+08:00   apps  Deployment       demo1                 myapp  OutOfSync  Missing              deployment.apps/myapp created
2022-08-18T21:40:19+08:00            Service       demo1                 myapp    Synced   Healthy              service/myapp created
2022-08-18T21:40:19+08:00   apps  Deployment       demo1                 myapp    Synced  Progressing              deployment.apps/myapp created
Name:               app01
Project:            default
Server:             https://kubernetes.default.svc
Namespace:          demo1
URL:                https://10.6.215.30:32382/applications/app01
Repo:               https://gitee.com/zouzou_busy/devops_test.git
Target:
Path:               app
SyncWindow:         Sync Allowed
Sync Policy:        <none>
Sync Status:        Synced to  (d7306f4)
Health Status:      Progressing
Operation:          Sync
Sync Revision:      d7306f4c729378979e1972a2cf857a9847ba0b8e
Phase:              Succeeded
Start:              2022-08-18 21:40:18 +0800 CST
Finished:           2022-08-18 21:40:19 +0800 CST
Duration:           1s
Message:            successfully synced (all tasks run)
GROUP  KIND        NAMESPACE  NAME   STATUS  HEALTH       HOOK  MESSAGE
       Service     demo1      myapp  Synced  Healthy            service/myapp created
apps   Deployment  demo1      myapp  Synced  Progressing        deployment.apps/myapp created

查看某个应用的 yaml 清单

# 查看某个应用的 yaml 清单
[root@master1 ~]# argocd app get app02 -o yaml
metadata:
  creationTimestamp: "2022-08-18T13:06:31Z"
  generation: 323
  managedFields:
  - apiVersion: argoproj.io/v1alpha1
    fieldsType: FieldsV1
    fieldsV1:
      f:spec:
        .: {}
        f:destination:
          .: {}
          f:namespace: {}
          f:server: {}
        f:project: {}
        f:source:
          .: {}
          f:path: {}
          f:repoURL: {}
          f:targetRevision: {}
        f:syncPolicy:
          .: {}
          f:syncOptions: {}
      f:status:
        .: {}
        f:health: {}
        f:summary: {}
        f:sync:
          .: {}
          f:comparedTo:
            .: {}
            f:destination: {}
            f:source: {}
    manager: Go-http-client
    operation: Update
    time: "2022-08-18T15:10:29Z"
  - apiVersion: argoproj.io/v1alpha1
    fieldsType: FieldsV1
    fieldsV1:
      f:status:
        f:health:
          f:status: {}
        f:history: {}
        f:operationState:
          .: {}
          f:finishedAt: {}
          f:message: {}
          f:operation:
            .: {}
            f:initiatedBy:
              .: {}
              f:username: {}
            f:retry: {}
            f:sync:
              .: {}
              f:revision: {}
              f:syncOptions: {}
              f:syncStrategy:
                .: {}
                f:hook: {}
          f:phase: {}
          f:startedAt: {}
          f:syncResult:
            .: {}
            f:resources: {}
            f:revision: {}
            f:source:
              .: {}
              f:path: {}
              f:repoURL: {}
              f:targetRevision: {}
        f:reconciledAt: {}
        f:resources: {}
        f:sourceType: {}
        f:summary:
          f:images: {}
        f:sync:
          f:comparedTo:
            f:destination:
              f:namespace: {}
              f:server: {}
            f:source:
              f:path: {}
              f:repoURL: {}
              f:targetRevision: {}
          f:revision: {}
          f:status: {}
    manager: argocd-application-controller
    operation: Update
    time: "2022-08-18T15:10:31Z"
  name: app02
  namespace: argocd
  resourceVersion: "7947672"
  uid: 6deb20f8-abf8-4a05-807c-388a22bdbb0d
spec:  # 我们定义的资源清单
  destination:
    namespace: demo2
    server: https://kubernetes.default.svc
  project: default
  source:
    path: app  # 仓库里的资源路径
    repoURL: https://gitee.com/zouzou_busy/devops_test.git  # 仓库地址
    targetRevision: HEAD
  syncPolicy:  # 同步策略
    syncOptions:
    - CreateNamespace=true  # 自动创建命名空间
status:
  health:
    status: Healthy
  history:
  - deployStartedAt: "2022-08-18T13:57:42Z"
    deployedAt: "2022-08-18T13:57:55Z"
    id: 0
    revision: 30f61b0cbc32d1dfc9992893a2f94c7ad21f0d9e
    source:
      path: app
      repoURL: https://gitee.com/zouzou_busy/devops_test.git
      targetRevision: HEAD
  - deployStartedAt: "2022-08-18T14:21:22Z"
    deployedAt: "2022-08-18T14:21:23Z"
    id: 1
    revision: 64f304bd426b0d6e23eb7850901418d453a31257
    source:
      path: app
      repoURL: https://gitee.com/zouzou_busy/devops_test.git
      targetRevision: HEAD
  - deployStartedAt: "2022-08-18T14:31:45Z"
    deployedAt: "2022-08-18T14:31:52Z"
    id: 2
    revision: 30f61b0cbc32d1dfc9992893a2f94c7ad21f0d9e
    source:
      path: app
      repoURL: https://gitee.com/zouzou_busy/devops_test.git
      targetRevision: HEAD
  - deployStartedAt: "2022-08-18T15:10:30Z"
    deployedAt: "2022-08-18T15:10:31Z"
    id: 3
    revision: 7228459e2b9afebe7c54ff3bad4216ce2ebcdcf9
    source:
      path: app
      repoURL: https://gitee.com/zouzou_busy/devops_test.git
      targetRevision: HEAD
  operationState:
    finishedAt: "2022-08-18T15:10:31Z"
    message: successfully synced (all tasks run)
    operation:
      initiatedBy:
        username: admin
      retry: {}
      sync:
        revision: 7228459e2b9afebe7c54ff3bad4216ce2ebcdcf9
        syncOptions:
        - CreateNamespace=true
        syncStrategy:
          hook: {}
    phase: Succeeded
    startedAt: "2022-08-18T15:10:30Z"
    syncResult:
      resources:
      - group: ""
        hookPhase: Running
        kind: Service
        message: service/myapp unchanged
        name: myapp
        namespace: demo2
        status: Synced
        syncPhase: Sync
        version: v1
      - group: apps
        hookPhase: Running
        kind: Deployment
        message: deployment.apps/myapp configured
        name: myapp
        namespace: demo2
        status: Synced
        syncPhase: Sync
        version: v1
      revision: 7228459e2b9afebe7c54ff3bad4216ce2ebcdcf9
      source:
        path: app
        repoURL: https://gitee.com/zouzou_busy/devops_test.git
        targetRevision: HEAD
  reconciledAt: "2022-08-19T01:58:06Z"
  resources:
  - health:
      status: Healthy
    kind: Service
    name: myapp
    namespace: demo2
    status: Synced
    version: v1
  - group: apps
    health:
      status: Healthy
    kind: Deployment
    name: myapp
    namespace: demo2
    status: Synced
    version: v1
  sourceType: Directory
  summary:
    images:
    - zouzou0214/myapp:v3
  sync:
    comparedTo:
      destination:
        namespace: demo2
        server: https://kubernetes.default.svc
      source:
        path: app
        repoURL: https://gitee.com/zouzou_busy/devops_test.git
        targetRevision: HEAD
    revision: 7228459e2b9afebe7c54ff3bad4216ce2ebcdcf9
    status: Synced

相关实践学习
通过Ingress进行灰度发布
本场景您将运行一个简单的应用,部署一个新的应用用于新的发布,并通过Ingress能力实现灰度发布。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
相关文章
|
6月前
|
Kubernetes Cloud Native 应用服务中间件
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
113 1
|
Cloud Native 网络安全 开发工具
云原生--argocd 仓库管理、集群管理
云原生--argocd 仓库管理、集群管理
|
Cloud Native 开发工具 git
云原生--argocd 自动同步
云原生--argocd 自动同步
|
Kubernetes Cloud Native 开发工具
云原生--argocd 创建应用、部署应用、回滚(二)
云原生--argocd 创建应用、部署应用、回滚
|
Cloud Native 测试技术 开发工具
云原生--argocd 创建应用、部署应用、回滚 (一)
云原生--argocd 创建应用、部署应用、回滚
|
存储 Kubernetes 开发工具
云原生--argocd 安装
云原生--argocd 安装
|
Cloud Native 关系型数据库 MySQL
centos命令行安装MySQL(云原生POD命令行安装MySQL)
centos命令行安装MySQL(云原生POD命令行安装MySQL)
253 0
centos命令行安装MySQL(云原生POD命令行安装MySQL)
|
JSON Kubernetes Cloud Native
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
179 0
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
|
3天前
|
Cloud Native 安全 数据安全/隐私保护
云原生架构下的微服务治理与挑战####
随着云计算技术的飞速发展,云原生架构以其高效、灵活、可扩展的特性成为现代企业IT架构的首选。本文聚焦于云原生环境下的微服务治理问题,探讨其在促进业务敏捷性的同时所面临的挑战及应对策略。通过分析微服务拆分、服务间通信、故障隔离与恢复等关键环节,本文旨在为读者提供一个关于如何在云原生环境中有效实施微服务治理的全面视角,助力企业在数字化转型的道路上稳健前行。 ####
|
5天前
|
运维 Kubernetes Cloud Native
云原生技术:容器化与微服务架构的完美结合
【10月更文挑战第37天】在数字化转型的浪潮中,云原生技术以其灵活性和高效性成为企业的新宠。本文将深入探讨云原生的核心概念,包括容器化技术和微服务架构,以及它们如何共同推动现代应用的发展。我们将通过实际代码示例,展示如何在Kubernetes集群上部署一个简单的微服务,揭示云原生技术的强大能力和未来潜力。