OpenShift 4 之 GitOps(5)用ArgoCD配置其他OpenShift资源

文章目录

  • 创建用户
  • 设置Build的全局属性
  • 设置Import Image的全局属性
  • 设置OpenShift Console控制台属性
  • 安装一个Operator

以下每一项配置都是先将配置yaml加载到ArgoCD中,然后在从ArgoCD同步到OpenShift上。

创建用户

  1. 创建一个OpenShift用户:user1,登录密码:MyPassword!
$ argocd app create htpasswd-oauth --repo https://github.com/liuxiaoyu-git/openshift4-gitops.git --path=identity-providers --dest-server=https://kubernetes.default.svc --dest-namespace=openshift-config
 
$ application 'htpasswd-oauth' created
[xiaoyliu-redhat.com@clientvm 0 ~]$ argocd app sync htpasswd-oauth
TIMESTAMP                  GROUP                    KIND   NAMESPACE                 NAME    STATUS    HEALTH        HOOK  MESSAGE
2020-03-06T01:26:47+00:00                           Secret  openshift-config         htpass-secret     OutOfSync     Missing
2020-03-06T01:26:47+00:00  config.openshift.io      OAuth                            cluster           OutOfSync
2020-03-06T01:26:48+00:00                           Secret  openshift-config         htpass-secret     Synced        Missing
。。。
 
GROUP                KIND    NAMESPACE         NAME           STATUS   HEALTH  HOOK  MESSAGE
                     Secret  openshift-config  htpass-secret  Synced                 secret/htpass-secret created
config.openshift.io  OAuth   openshift-config  cluster        Running  Synced        oauth.config.openshift.io/cluster configured
  1. 用user1/MyPassword!登录验证。
$ oc login  https://api.cluster-beijing-b510.beijing-b510.example.opentlc.com:6443 -u user1 -p MyPassword!
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n): y
 
Login successful.
 
You don't have any projects. You can try to create a new project, by running
 
    oc new-project <projectname>

设置Build的全局属性

$ argocd app create builds-config --repo https://github.com/dgoodwin/openshift4-gitops.git --path=builds/base --dest-server=https://kubernetes.default.svc --dest-namespace=openshift-config
application 'builds-config' created
 
$ argocd app sync builds-config
TIMESTAMP                  GROUP                      KIND   NAMESPACE                  NAME     STATUS    HEALTH        HOOK  MESSAGE
2020-03-06T01:46:30+00:00  config.openshift.io        Build                             cluster  OutOfSync
。。。
 
GROUP                KIND   NAMESPACE         NAME     STATUS   HEALTH  HOOK  MESSAGE
config.openshift.io  Build  openshift-config  cluster  Running  Synced        build.config.openshift.io/cluster configured. Warning:  apply should be used on resource created by either  create --save-config or  apply
config.openshift.io  Build                    cluster  Synced

设置Import Image的全局属性

  1. 设置用户只能从quay.io导入镜像。
$ argocd app create image-config --repo https://github.com/dgoodwin/openshift4-gitops.git --path=image --dest-server=https://kubernetes.default.svc --dest-namespace=openshift-config
ync image-configapplication 'image-config' created

$ argocd app sync image-config
TIMESTAMP                  GROUP                     KIND   NAMESPACE                NAME       STATUS   HEALTH        HOOK  MESSAGE
2020-03-06T02:01:03+00:00  config.openshift.io       Image                           cluster    Synced
。。。
 
GROUP                KIND   NAMESPACE         NAME     STATUS   HEALTH  HOOK  MESSAGE
config.openshift.io  Image  openshift-config  cluster  Running  Synced        image.config.openshift.io/cluster unchanged
config.openshift.io  Image                    cluster  Synced

设置OpenShift Console控制台属性

  1. 设置OpenShift Console属性,使得logout后自动跳转到google。
$ argocd app create console-config --repo https://github.com/dgoodwin/openshift4-gitops.git --path=console --dest-server=https://kubernetes.default.svc --dest-namespace=openshift-config
pp sync console-config
application 'console-config' created

$ argocd app sync console-config
TIMESTAMP                  GROUP                   KIND   NAMESPACE                  NAME     STATUS    HEALTH        HOOK  MESSAGE
2020-03-06T02:02:30+00:00  config.openshift.io     Console                           cluster  OutOfSync
。。。
 
GROUP                KIND     NAMESPACE         NAME     STATUS   HEALTH  HOOK  MESSAGE
config.openshift.io  Console  openshift-config  cluster  Running  Synced        console.config.openshift.io/cluster configured. Warning:  apply should be used on resource created by either  create --save-config or  apply
config.openshift.io  Console                    cluster  Synced

安装一个Operator

  1. 安装Grafana Operator。
$ argocd app create grafana-operator --repo https://github.com/dgoodwin/openshift4-gitops.git --path=grafana-operator --dest-server=https://kubernetes.default.svc --dest-namespace=default
application 'grafana-operator' created
 
$ argocd app sync grafana-operator
TIMESTAMP                  GROUP                 KIND           NAMESPACE             NAME                 STATUS     HEALTH        HOOK  MESSAGE
2020-03-06T02:05:33+00:00                        Namespace                            my-grafana-operator  OutOfSync  Missing
2020-03-06T02:05:33+00:00  operators.coreos.com  OperatorGroup  my-grafana-operator   operatorgroup        OutOfSync  Missing
2020-03-06T02:05:33+00:00  operators.coreos.com  Subscription   my-grafana-operator   my-grafana-operator  OutOfSync  Missing
2020-03-06T02:05:34+00:00                        Namespace                            my-grafana-operator  Synced     Missing
2020-03-06T02:05:34+00:00  operators.coreos.com  Subscription   my-grafana-operator   my-grafana-operator  Synced     Missing
。。。
 
GROUP                 KIND           NAMESPACE            NAME                 STATUS   HEALTH  HOOK  MESSAGE
                      Namespace      default              my-grafana-operator  Running  Synced        namespace/my-grafana-operator created
operators.coreos.com  Subscription   my-grafana-operator  my-grafana-operator  Synced                 subscription.operators.coreos.com/my-grafana-operator created
operators.coreos.com  OperatorGroup  my-grafana-operator  operatorgroup        Synced                 operatorgroup.operators.coreos.com/operatorgroup created
                      Namespace                           my-grafana-operator  Synced
  1. 查看安装结果
    在这里插入图片描述

你可能感兴趣的:(ArgoCD,GitOps,OpenShift,4)