您的位置:首页 > 财经 > 金融 > 成都地推公司_本科专业建设规划_百度快速优化软件排名_域名检测

成都地推公司_本科专业建设规划_百度快速优化软件排名_域名检测

2024/12/24 8:09:56 来源:https://blog.csdn.net/weixin_43258559/article/details/143437162  浏览:    关键词:成都地推公司_本科专业建设规划_百度快速优化软件排名_域名检测
成都地推公司_本科专业建设规划_百度快速优化软件排名_域名检测

在K8s平台部署个人博客

  • 实验步骤
    • 查看wordpress前端的service
    • 浏览器访问http://node_ip:30090

实验步骤

kubectl create secret generic mysql-pass --from-literal=password=YOUR_PASSWORD

把mysql.tar.gz和wordpress.tar.gz上传到K8s工作节点,手动解压即可:
通过网盘分享的文件:wordpress.tar.gz
链接: https://pan.baidu.com/s/1nISFKNIyANvcuBAWE9MAMQ?pwd=u77k 提取码: u77k
通过网盘分享的文件:mysql.tar.gz
链接: https://pan.baidu.com/s/1NVw3fULvQ3NOAAKtjU7nOw?pwd=8r2v 提取码: 8r2v

docker load -i mysql.tar.gz
docker load -i wordpress.tar.gz
ctr –n=k8s.io images import mysql.tar.gz
ctr –n=k8s.io images import wordpress.tar.gz

部署服务

cat mysql.yaml
apiVersion: v1
kind: Service
metadata:name: wordpress-mysqllabels:app: wordpress
spec:ports:- port: 3306selector:app: wordpresstier: mysqlclusterIP: None
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:name: wordpress-mysqllabels:app: wordpress
spec:replicas: 1selector:matchLabels:app: wordpresstier: mysqlstrategy:type: Recreatetemplate:metadata:labels:app: wordpresstier: mysqlspec:containers:- image: mysql:5.6name: mysqlenv:- name: MYSQL_ROOT_PASSWORDvalueFrom:secretKeyRef:name: mysql-passkey: passwordports:- containerPort: 3306name: mysqlvolumeMounts:- name: mysql-persistent-storagemountPath: /var/lib/mysqlvolumes:- name: mysql-persistent-storagehostPath:path: /datawordpresstype: DirectoryOrCreate
cat wordpress.yaml
apiVersion: v1
kind: Service
metadata:name: wordpresslabels:app: wordpress
spec:type: NodePortports:- port: 80nodePort: 30090selector:app: wordpresstier: frontend
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:name: wordpresslabels:app: wordpress
spec:selector:matchLabels:app: wordpresstier: frontendstrategy:type: Recreatetemplate:metadata:labels:app: wordpresstier: frontendspec:containers:- image: wordpress:4.8-apachename: wordpressenv:- name: WORDPRESS_DB_HOSTvalue: wordpress-mysql- name: WORDPRESS_DB_PASSWORDvalueFrom:secretKeyRef:name: mysql-passkey: passwordports:- containerPort: 80name: wordpressvolumeMounts:- name: wordpress-persistent-storagemountPath: /var/www/htmlvolumes:- name: wordpress-persistent-storagehostPath:path: /datamysqlwordpresstype: DirectoryOrCreate
kubectl apply -f mysql.yaml
kubectl apply -f wordpress.yaml

查看wordpress前端的service

kubectl get svc -l app=wordpress
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
wordpress NodePort 10.110.119.68 <none> 80:30090/TCP 36s
wordpress-mysql ClusterIP None <none> 3306/TCP 43s

浏览器访问http://node_ip:30090

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com