OpenShift-通过Operator-SDK制作Operator
制作Operator过程 下载安装operator-sdk 创建github仓库 operator-sdk创建应用 12345$ operator-sdk new memcached-go-operator --repo=github.com/example-inc/memcached-operator$ # or$ operator-sdk new memcached-ansible-operator --api-version=fcloudy.com/v1alpha1 --kind=Memcached --type=ansible$ # or$ operator-sdk new memcached-helm-operator --api-version=fcloudy.com/v1alpha1 --kind=Memcached --type=helm operator-sdk new默认使用的type为go,必须在$GOPATH目录下创建项目。type为go时项目的目录结构如下:项目的目录结构 type的可选值还可以为:ansible与helm,如果是这两个,则还可以带参数...
OpenShift-集群为项目提供专属节点
背景介绍在生产实践中,某些系统因一些特殊的要求,需要独占节点,即专属节点:具有特殊要求的应用POD必须运行在这些专属节点上;同时这些节点不为其它应用服务。本文将提供一种具体的配置策略,以满足这种特殊的调度需求。该策略主要使用到两种工具: 节点标签实现应用与节点的绑定 污点配置实现其它应用不会被调度到该节点。 设置步骤 为专属节点设置特定标签LABEL:dedicated=sys0,及设置污点 12$ oc label node node-10 dedicated=sys0$ oc adm taint nodes node-10 dedicated=sys0:NoSchedule 在使用专属节点的应用编排中绑定的Node 123456789101112spec: replicas: 1 template: metadata: name: nginx labels: app: nginx spec: nodeSelector: dedicated: "sys0" ...
OpenShift上使用NFS作为共享存储的线上问题
NFS exports文件配置格式<输出目录> [客户端1 选项(访问权限,用户映射,其他)] [客户端2 选项(访问权限,用户映射,其他)] a. 输出目录:输出目录是指NFS系统中需要共享给客户机使用的目录; b. 客户端:客户端是指网络中可以访问这个NFS输出目录的计算机客户端常用的指定方式 指定ip地址的主机:192.168.0.200指定子网中的所有主机:192.168.0.0/24 192.168.0.0/255.255.255.0指定域名的主机:david.bsmart.cn指定域中的所有主机:.bsmart.cn所有主机: c. 选项:选项用来设置输出目录的访问权限、用户映射等。 NFS主要有3类选项: 访问权限选项 设置输出目录只读:ro设置输出目录读写:rw 用户映射选项all_squash:将远程访问的所有普通用户及所属组都映射为匿名用户或用户组(nfsnobody);no_all_squash:与all_squash取反(默认设置);root_squash:将root用户及所属组都映射为匿名用户或用户组(默认设置);...
OpenShift中etcd集群的某个etcd服务文件损坏,导致节点故障,恢复过程
问题etcd集群中某个etcd出现故障,使用docker ps -a | grep etcd | grep -v POD查看etcd节点,发现它异常退出。 123$ docker logs -f <etcd-container-id>....etcdserver : open wal error: wal: file not found 恢复步骤大方向步骤:一、将问题etcd节点从etcd集群剥离;二、将恢复的新的etcd节点添加到etcd集群。具体步骤如下: 查看etcd状态 1234$ etcdctl2 cluster-health$ ## 获取问题节点的member ID$ etcdctl2 member remove <member ID>$ ## 将问题etcd服务从etcd集群中删除 停止问题节点上的etcd服务 12$ mkdir -p /etc/origin/node/pods-stopped$ mv /etc/origin/node/pods/* /etc/origin/node/pods-stopped/ 删除问题节点上的...
OpenShift中如何将PV与PVC绑定
PV/PVC是什么?PV(Persistent Volume):描述的是持久化的Volume实体概念,生命周期与Pod创建和销毁事件无关。要么运行事先准备好,要么通过动态创建。PVC(PersistentVolumeClaim):PVC是对PV的请求,申明Pod所希望使用的持久化存储的属性,例如容量,读写权限。 Kubernete Volumes能够帮忙应用持久化数据,PV/PVC是Kubernetes Volumes存储类型的一种,其它类型还有:本地存储:emptyDir / hostPath网络存储:in-tree: aws ElasticBlockStore / gcePersistentDisk / nfsout-of-tree:csi等网络存储插件Project Volume:secret / configmap / downwardAPI / serviceAccountToken PV/PVC的意义 使用不同的控制器来管理计算与存储资源,解耦POD与Volume的生命周期,实现...
OpenShift中如何通过脚本获取Alertmanager的告警数据
一、为什么需要通过脚本获取告警信息 二、Alertmanager的告警信息 三、amtool工具获取告警信息 12# oc exec -it alertmanager-main-0 -c alertmanager -n openshift-monitoring -- amtool alert query 'severity=critical' --alertmanager.url http://localhost:9093# oc exec -it alertmanager-main-0 -c alertmanager -n openshift-monitoring -- amtool alert query 'severity=critical' --alertmanager.url http://localhost:9093 -o extended -o:默认值为simple,输出格式,还可以是extended,json 四、amtool更多功能
OpenShift中的Grafana监控界面无法完成登录
问题描述:访问OpenShift默认的grafana无法跳转到OpenShift console界面。报如下错误: 12{"error":"invalid_request","error_description":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."} 解决办法: 1$ oc patch sa grafana -p '{"metadata":{"annotations":{"serviceaccounts.openshift.io/oauth-redirecturi.first":"https://grafana.ap...
OpenShift之应用环境变量篇
通过环境变量向容器暴露 Pod 信息
OpenShift中节点的垃圾收集——容器与镜像
参考文档https://docs.openshift.com/container-platform/3.11/admin_guide/garbage_collection.html
OpenShift企业版离线安装:下载RedHat-Repo源及镜像文件
为了安全起见,在很多企业,网络环境是不能连接外网的,而需要使用OpenShift的话,就需要离线部署。离线部署与在线部署最大区别,就是我们得自己准备介质源:YUM源与镜像仓库。只要你拥有红帽订阅,下载最新的介质,其实很简单。 一、同步YUM源RHEL主机注册到红帽订阅,并关联到相应的YUM仓库 12345678910$ subscription-manager register$ subscription-manager refresh$ subscription-manager list --available --matches '*OpenShift*'$ subscription-manager attach --pool=<pool_id>$ subscription-manager repos --disable="*"$ subscription-manager repos \ --enable="rhel-7-server-rpms" \ --enable="rhel-...



