一、k8s安装
自行参考官方文档安装
二、编写yaml
cat mogdb.yaml
apiVersion: v1 kind: Pod metadata: name: mogdb spec: containers: - image: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:2.0.1_arm_k8s command: ["/bin/bash"] args: ["-c", "--", "/usr/local/bin/entrypoint.sh mogdb"] imagePullPolicy: IfNotPresent name: mogdb ports: - containerPort: 5432 name: mogdb protocol: TCP volumeMounts: - mountPath: /mogdb name: data imagePullSecrets: - name: default-secret volumes: - name: data emptyDir: {}
x86镜像源课换为swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:2.0.1_amd_k8s
三、启动
1. 启动pod
kubectl create -f mogdb.yaml pod/mogdb created kubectl get pod mogdb NAME READY STATUS RESTARTS AGE mogdb 1/1 Running 0 26s
2. 进入容器
[root@mogdb-kernel-0005 ~]# kubectl exec -it mogdb -- bash root@mogdb:/# su - omm omm@mogdb:~$ gsql -d postgres -p5432 -r gsql ((MogDB 2.0.1 build f892ccb7) compiled at 2021-07-09 16:12:59 commit 0 last mr ) Non-SSL connection (SSL connection is recommended when requiring high-security) Type "help" for help. postgres=# \copyright MogDB Database Management System Copyright (c) Yunhe Enmo (Beijing) Information Technology Co., Ltd. Copyright 2020 , All rights reserved.