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

13 篇文章 1 订阅
10 篇文章 1 订阅

OpenShift 4.x HOL教程汇总
说明:本文已经在OpenShift 4.6环境中验证


以下每一项配置都是先将配置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

$ 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 $(oc whoami --show-server) -u user1 -p MyPassword!
Login successful.
 
You have one project on this server: "user1-project"
 
Using project "user1-project".

设置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-12-26T11:05:28+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-12-26T02: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-12-26T02: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-12-26T02:05:33+00:00                        Namespace                            my-grafana-operator  OutOfSync  Missing
2020-12-26T02:05:33+00:00  operators.coreos.com  OperatorGroup  my-grafana-operator   operatorgroup        OutOfSync  Missing
2020-12-26T02:05:33+00:00  operators.coreos.com  Subscription   my-grafana-operator   my-grafana-operator  OutOfSync  Missing
2020-12-26T02:05:34+00:00                        Namespace                            my-grafana-operator  Synced     Missing
2020-12-26T02: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. 查看安装结果
    在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值