标签:web name ai app rancher home k8s metadata
rancher部署
一、准备介质
镜像v2.4.17
docker pull rancher/rancher:v2.4.17
二、使用docker安装
点击查看代码
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 \
-v /home/ap/aipf/rancher_home/rancher:/var/lib/rancher \
-v /home/ap/aipf/rancher_home/auditlog:/var/log/auditlog \
--name rancher rancher/rancher:v2.4.17
访问本机ip
三、使用k8s部署rancher
3.1、创建namespace
kubectl create ns rancher
3.2、创建rancher的存储路径pv/pvc
点击查看代码
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-rancher
namespace: rancher
spec:
capacity:
storage: 20Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: local-storage
local:
path: /home/ap/nas_b
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- k8s-master
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-rancher
namespace: rancher
spec:
accessModes:
- ReadWriteMany
storageClassName: local-storage
resources:
requests:
storage: 15Gi
3.3、创建rancher的配置文件
点击查看代码
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: rancher
name: rancher
namespace: rancher
spec:
replicas: 1
selector:
matchLabels:
app: rancher
template:
metadata:
labels:
app: rancher
containers:
- image: rancher/rancher:v2.4.17
imagePullPolicy: IfNotPresent
name: rancher
envFrom:
- configMapRef:
name: ai-platform-config
ports:
- containerPort: 80
volumeMounts:
- mountPath: /var/lib/rancher
name: ai-rancher-volumes
subPath: rancher_home/rancher
- mountPath: /var/log/auditlog
name: ai-rancher-volumes
subPath: rancher_home/auditlog
volumes:
- name: ai-rancher-volumes
persistentVolumeClaim:
claimName: pvc-rancher
---
apiVersion: v1
kind: Service
metadata:
name: rancher
labels:
app: rancher
namespace: rancher
spec:
type: ClusterIP
selector:
app: ai-admin-web
ports:
- port: 80
targetPort: 80
点击查看代码
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: rancher
name: rancher
namespace: rancher
spec:
replicas: 1
selector:
matchLabels:
app: rancher
template:
metadata:
labels:
app: rancher
spec:
nodeSelector:
rancherbase: "true"
containers:
- image: rancher.harbor.io/rancher/rancher:v2.4.17
imagePullPolicy: IfNotPresent
name: rancher
envFrom:
- configMapRef:
name: ai-platform-config
ports:
- containerPort: 80
volumeMounts:
- mountPath: /var/lib/rancher
name: ai-rancher-volumes
subPath: rancher_home/rancher
- mountPath: /var/log/auditlog
name: ai-rancher-volumes
subPath: rancher_home/auditlog
volumes:
- name: ai-rancher-volumes
persistentVolumeClaim:
claimName: pvc-rancher
---
apiVersion: v1
kind: Service
metadata:
name: rancher
labels:
app: rancher
namespace: rancher
spec:
type: ClusterIP
selector:
app: ai-admin-web
ports:
- port: 80
targetPort: 80
3.4、使用上面的配置文件启动rancher服务
[root@k8s-master conf]# kubectl apply -f rancher-pv.yaml
persistentvolume/pv-rancher created
persistentvolumeclaim/pvc-rancher created
[root@k8s-master conf]# kubectl get pv,pvc -A | grep rancher
persistentvolume/pv-rancher 20Gi RWX Retain Bound rancher/pvc-rancher local-storage 79s
rancher persistentvolumeclaim/pvc-rancher Bound pv-rancher 20Gi RWX local-storage 79s
3.5、启动rancher服务
[root@k8s-master conf]# kubectl apply -f rancher.yaml
deployment.apps/rancher created
service/rancher created
标签:web,name,ai,app,rancher,home,k8s,metadata 来源: https://www.cnblogs.com/pythonx/p/15711816.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。