《OpenShift / RHEL / DevSecOps 汇总目录》
说明:本文已经在 OpenShift 4.14 + RHODS 2.5.0 的环境中验证
说明:请先根据《OpenShift 4 - 部署 OpenShift AI 环境,运行 AI/ML 应用(视频)》一文完成 OpenShift AI 环境的安装。
注意:如无特殊说明,和 OpenShift AI 相关的 Blog 均无需 GPU。
在 Jupyter Notebook 中我们先用本地图片测试一个预先训练好的机器学习模型,然后将该模型的功能封装为一个 REST 服务。在完成本地测后再将物体识别模块部署到 OpenShift 上。
(app-root) (app-root) pip install Pillow==9.5.0
Collecting Pillow==9.5.0
Downloading Pillow-9.5.0-cp39-cp39-manylinux_2_28_x86_64.whl (3.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 84.0 MB/s eta 0:00:00
Installing collected packages: Pillow
Attempting uninstall: Pillow
Found existing installation: Pillow 10.1.0
Uninstalling Pillow-10.1.0:
Successfully uninstalled Pillow-10.1.0
Successfully installed Pillow-9.5.0
[notice] A new release of pip available: 22.2.2 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
安装 AMQ Streams Operator。
创建名为 object-detect 的 Kafka 实例。
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
name: images
labels:
strimzi.io/cluster: my-cluster
namespace: object-detect
spec:
config:
retention.ms: 604800000
segment.bytes: 1073741824
partitions: 1
replicas: 3
$ oc get kafkatopics -n object-detect
NAME CLUSTER PARTITIONS REPLICATION FACTOR READY
consumer-offsets---84e7a678d08f4bd226872e5cdd4eb527fadc1c6a object-detect 50 3 True
images my-cluster 1 3
notebook-test my-cluster 1 3
objects my-cluster 1 3
strimzi-store-topic---effb8e3e057afce1ecf67c3f5d8e4e3ff177fc55 object-detect 1 3 True
strimzi-topic-operator-kstreams-topic-store-changelog---b75e702040b99be8a9263134de3507fc0cc4017b object-detect 1 3 True
https://github.com/blues-man/object-detection-kafka-consumer
apiVersion: v1
kind: Secret
metadata:
name: object-detection-kafka
labels:
app: object-detection
app.kubernetes.io/component: object-detection
app.kubernetes.io/instance: object-detection
app.kubernetes.io/part-of: object-detection
data:
stringData:
KAFKA_BOOTSTRAP_SERVER: object-detect-kafka-brokers.object-detect.svc.cluster.local:8443
KAFKA_TOPIC_IMAGES: images
KAFKA_TOPIC_OBJECTS: objects
https://redhat-scholars.github.io/rhods-od-workshop/rhods-od-workshop/index.html