当前位置:网站首页>k8s运行oracle
k8s运行oracle
2022-07-07 01:03:00 【喝醉酒的小白】
1、创建命名空间
alias k='kubectl'
k create ns oracle-server
k get ns
2、创建.yaml文件
K8S安装Oracle11g
备注:端口1521 -> 31521
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: oracle-server
name: oracle-server
namespace: oracle-server
spec:
selector:
matchLabels:
app: oracle-server
template:
metadata:
labels:
app: oracle-server
spec:
containers:
- image: registry.cn-hangzhou.aliyuncs.com/liyusoft/tool-oracle:v1.0.1
imagePullPolicy: IfNotPresent
name: oracle-server
ports:
- containerPort: 31521
command: ['/assets/entrypoint.sh']
env:
- name: ORACLE_HOME
value: "/opt/oracle/app/product/11.2.0/dbhome_1"
- name: ORACLE_SID
value: "orcl"
volumeMounts: #挂载持久存储卷
- name: oracle-volume #挂载设备的名字,与volumes[*].name 需要对应
mountPath: /opt/oracle/dpdump/1/dump_dir #挂载到容器的某个路径下
readOnly: true
volumes: #定义一组挂载设备
- name: oracle-volume #定义一个挂载设备的名字
hostPath:
path: /opt/ #挂载设备类型为hostPath,路径为宿主机下的/opt,这里设备类型支持很多种
3、运行pod
k apply -f oracle.yaml
alias ko='k -n oracle-server'
4、进入pod
问题:
Error from server (BadRequest): container "oracle-server" in pod "oracle-server" is waiting to start: trying and failing to pull image.
Normal Pulling 3m5s kubelet Pulling image "registry.cn-hangzhou.aliyuncs.com/liyusoft/tool-oracle:v1.0.1"
解决方案:
需等待大约10分钟,正在拉取镜像
ko get pod
NAME READY STATUS RESTARTS AGE
oracle-server-56c657455b-7kfj6 1/1 Running 0 4h21m
kubectl exec -it oracle-server-56c657455b-7kfj6 bash
5、查看pod
ko describe pod oracle-server-56c657455b-7kfj6
Name: oracle-server-56c657455b-7kfj6
Namespace: oracle-server
Priority: 0
Node: */**** Start Time: Wed, 06 Jul 2022 18:06:36 +0800 Labels: app=oracle-server pod-template-hash=56c657455b Annotations: <none> Status: Running IP: 10.244.0.105 IPs: IP: 10.244.0.105 Controlled By: ReplicaSet/oracle-server-56c657455b Containers: oracle-server: Container ID: docker://d001f4097d165fcb11203cd87df50308a9c4eb335ec9edb1f05373bbff7b9269 Image: registry.cn-hangzhou.aliyuncs.com/liyusoft/tool-oracle:v1.0.1 Image ID: docker-pullable://registry.cn-hangzhou.aliyuncs.com/liyusoft/[email protected]:660da6cea178223432e406b95435bf0cd62d6ccc7a637f9f51d32e87a4fb54c7 Port: 31525/TCP Host Port: 0/TCP Command: /assets/entrypoint.sh State: Running Started: Wed, 06 Jul 2022 18:15:41 +0800 Ready: True Restart Count: 0 Environment: ORACLE_HOME: /opt/oracle/app/product/11.2.0/dbhome_1 ORACLE_SID: orcl Mounts: /opt/oracle/dpdump/1/dump_dir from oracle-volume (ro) /var/run/secrets/kubernetes.io/serviceaccount from default-token-kzhg5 (ro) Conditions: Type Status Initialized True Ready True ContainersReady True PodScheduled True Volumes: oracle-volume: Type: HostPath (bare host directory volume) Path: /opt/dump_dir HostPathType: default-token-kzhg5: Type: Secret (a volume populated by a Secret) SecretName: default-token-kzhg5 Optional: false QoS Class: BestEffort Node-Selectors: <none> Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s node.kubernetes.io/unreachable:NoExecute for 300s Events: <none>
6、查看日志
ko logs -f oracle-server-56c657455b-7kfj6
7、删除pod
ko delete pod oracle-server-56c657455b-7kfj6
pod "oracle-server-56c657455b-7kfj6" deleted
问题:删除后又自己重启了
ko get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
oracle-server 1/1 1 1 4h44m
解决方案1:不行!
ko delete pod oracle-server-56c657455b-lffbf --force --grace-period=0
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "oracle-server-56c657455b-lffbf" force deleted
ko get pod
Unable to connect to the server: net/http: TLS handshake timeout
ko get pod
Error from server (Timeout): the server was unable to return a response in the time allotted, but may still be processing the request (get pods)
You have new mail in /var/spool/mail/root
ko get pod
NAME READY STATUS RESTARTS AGE
oracle-server-56c657455b-cwcnt 1/1 Running 0 3m48s
解决方案2:删除命名空间
ko delete --all pods
Error from server (Timeout): the server was unable to return a response in the time allotted, but may still be processing the request (get pods)
kubectl delete ns oracle-server
namespace "oracle-server" deleted
You have new mail in /var/spool/mail/root
边栏推荐
- jvm命令之 jcmd:多功能命令行
- 解决pod install报错:ffi is an incompatible architecture
- make makefile cmake qmake都是什么,有什么区别?
- 目标检测中的损失函数与正负样本分配:RetinaNet与Focal loss
- 从“跑分神器”到数据平台,鲁大师开启演进之路
- Introduction to the extension implementation of SAP Spartacus checkout process
- 外设驱动库开发笔记43:GPIO模拟SPI驱动
- R language [logic control] [mathematical operation]
- Check Point:企业部署零信任网络(ZTNA)的核心要素
- New Year Fireworks code plus copy, are you sure you don't want to have a look
猜你喜欢
Why does the data center need a set of infrastructure visual management system
Harmonyos practice - Introduction to development, analysis of atomized services
Check point: the core element for enterprises to deploy zero trust network (ztna)
Check Point:企业部署零信任网络(ZTNA)的核心要素
Understand the deserialization principle of fastjson for generics
驱动开发中platform设备驱动架构详解
Introduction to yarn (one article is enough)
R language [logic control] [mathematical operation]
Question 102: sequence traversal of binary tree
Career experience feedback to novice programmers
随机推荐
目标检测中的损失函数与正负样本分配:RetinaNet与Focal loss
Mac version PHP installed Xdebug environment (M1 version)
Input of native applet switches between text and password types
JVM命令之- jmap:导出内存映像文件&内存使用情况
Financial risk control practice - decision tree rule mining template
Classic questions about data storage
A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]
CMD permanently delete specified folders and files
Convert numbers to string strings (to_string()) convert strings to int sharp tools stoi();
[shell] clean up nohup Out file
PTA ladder game exercise set l2-002 linked list de duplication
Solve pod install error: FFI is an incompatible architecture
深度聚类:将深度表示学习和聚类联合优化
解决pod install报错:ffi is an incompatible architecture
每秒10W次分词搜索,产品经理又提了一个需求!!!(收藏)
CTFshow--常用姿势
Red Hat安装内核头文件
Understand the deserialization principle of fastjson for generics
Harmonyos practice - Introduction to development, analysis of atomized services
make makefile cmake qmake都是什么,有什么区别?