云原生--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

 

posted @   邹邹很busy。  阅读(251)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2021-10-17 TypeScript--泛型(generic)
点击右上角即可分享
微信分享提示

目录导航