云原生--argocd 命令行

简介: 云原生--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搭建和管理企业级网站应用
相关文章
|
7月前
|
Kubernetes Cloud Native 应用服务中间件
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
122 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)
258 0
centos命令行安装MySQL(云原生POD命令行安装MySQL)
|
JSON Kubernetes Cloud Native
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
181 0
云原生|kubernetes 你真的学废了吗---实战k8s 二(命令行创建各类资源)
|
23天前
|
运维 Cloud Native 持续交付
深入理解云原生架构及其在现代企业中的应用
随着数字化转型的浪潮席卷全球,企业正面临着前所未有的挑战与机遇。云计算技术的迅猛发展,特别是云原生架构的兴起,正在重塑企业的IT基础设施和软件开发模式。本文将深入探讨云原生的核心概念、关键技术以及如何在企业中实施云原生策略,以实现更高效的资源利用和更快的市场响应速度。通过分析云原生架构的优势和面临的挑战,我们将揭示它如何助力企业在激烈的市场竞争中保持领先地位。
|
21天前
|
Kubernetes Cloud Native 微服务
探索云原生技术:容器化与微服务架构的融合之旅
本文将带领读者深入了解云原生技术的核心概念,特别是容器化和微服务架构如何相辅相成,共同构建现代软件系统。我们将通过实际代码示例,探讨如何在云平台上部署和管理微服务,以及如何使用容器编排工具来自动化这一过程。文章旨在为开发者和技术决策者提供实用的指导,帮助他们在云原生时代中更好地设计、部署和维护应用。