OLM(operator lifecycle manager)简介

强保臣
2023-12-01

OLM是一组cluster资源的集合,用来管理一个operator的lifecycle.

安装olm

假设你已经安装operator-sdk

operator-sdk olm install  
operator-sdk olm status 

我的输出为

INFO[0000] Fetching CRDs for version "v0.21.2"          
INFO[0000] Fetching resources for resolved version "v0.21.2" 

使用olm获取operator list

 kubectl get packagemanifest -n olm

安装一个operator

  1. 创建一个group
carawang@carawangs-MacBook-Pro olm % kubectl apply -f operatorgroup.yaml 
operatorgroup.operators.coreos.com/og-single created
carawang@carawangs-MacBook-Pro olm % cat operatorgroup.yaml 
kind: OperatorGroup
apiVersion: operators.coreos.com/v1
metadata:
  name: og-single
  namespace: default
spec:
  targetNamespaces:
  - default

2. 创建一个订阅

carawang@carawangs-MacBook-Pro olm % kubectl apply -f subscription.yaml
subscription.operators.coreos.com/etcd created
carawang@carawangs-MacBook-Pro olm % cat subscription.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: etcd
  namespace: default
spec:
  channel: singlenamespace-alpha
  installPlanApproval: Automatic
  name: etcd
  source: operatorhubio-catalog
  sourceNamespace: olm
  startingCSV: etcdoperator.v0.9.2
 类似资料: