k8s离线部署学习-服务部署(nginx)
程序员文章站
2022-05-27 19:17:37
...
准备Nginx镜像,并推送到仓库
docker load -i nginx.tar
docker tag nginx:1.18 10.0.7.125:8000/library/nginx:1.18
docker push 10.0.7.125:8000/library/nginx:1.18
nginx-pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx
namespace: default
spec:
accessModes:
- ReadWriteOnce
storageClassName: nfs-client
resources:
requests:
storage: 1Gi
nginx-deploy
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: 10.0.7.125:8000/library/nginx:1.18
ports:
- containerPort: 80
volumeMounts:
- mountPath: /usr/share/nginx/html
name: nginx
volumes:
- name: nginx
persistentVolumeClaim:
claimName: nginx
nginx-svc
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
type: NodePort
selector:
app: nginx
ports:
- port: 80
targetPort: 80
nodePort: 30000
访问
http://10.0.7.70:30000
推荐阅读
-
Docker学习笔记之k8s部署方法
-
django2+uwsgi+nginx上线部署到服务器Ubuntu16.04
-
k8s中负载均衡器【ingress-nginx】部署
-
.net core3.0部署Linux服务器 使用Docker容器和Nginx反代理教程
-
Linux服务器部署.Net Core笔记:五、安装Nginx
-
大数据之nginx+js点击流日志采集服务部署教程
-
部署支持 https 的 Nginx 服务
-
Spring框架学习笔记(6)——阿里云服务器部署Spring Boot项目(jar包)
-
详解Nginx + Tomcat 反向代理 如何在高效的在一台服务器部署多个站点
-
Centos部署django服务nginx+uwsgi的方法