《OpenShift 4.x HOL教程汇总》
说明:本文已经在OpenShift 4.6环境中验证
以下每一项配置都是先将配置yaml加载到ArgoCD中,然后在从ArgoCD同步到OpenShift上。
创建用户
- 创建一个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
- 用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的全局属性
- 设置用户只能从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控制台属性
- 设置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
- 安装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
- 查看安装结果