应用Kubernetes疾速启用一个动态页面

将html动态页面搁置在nfs目录下,通过Deployment启动时挂在到nginx页面目录即可

查看yaml内容

root@hello:~# cat cby.yamlapiVersion: apps/v1kind: Deploymentmetadata:  name: chenbyspec:  replicas: 3  selector:    matchLabels:      app: chenby  template:    metadata:      labels:        app: chenby    spec:      containers:      - name: chenby        image: nginx        resources:          limits:            memory: "128Mi"            cpu: "500m"        ports:        - containerPort: 80        volumeMounts:        - name: cby-nfs          mountPath: /usr/share/nginx/html/      volumes:      - name: cby-nfs        nfs:          server: 192.168.1.123          path: /cby-3/nfs/html---apiVersion: v1kind: Servicemetadata:  name: chenbyspec:  type: NodePort  selector:    app: chenby  ports:  - port: 80    targetPort: 80

查看验证

root@hello:~# kubectl  get deployments.apps  chenby  -o wideNAME     READY   UP-TO-DATE   AVAILABLE   AGE     CONTAINERS   IMAGES   SELECTORchenby   3/3     3            3           4m44s   chenby       nginx    app=chenbyroot@hello:~# root@hello:~# kubectl  get pod -o wide | grep chenbychenby-77b57649c7-qv2ps                  1/1     Running   0          5m2s   172.17.125.19    k8s-node01     <none>           <none>chenby-77b57649c7-rx98c                  1/1     Running   0          5m2s   172.25.214.207   k8s-node03     <none>           <none>chenby-77b57649c7-tx2dz                  1/1     Running   0          5m2s   172.25.244.209   k8s-master01   <none>           <none>root@hello:~# kubectl  get svc -o wide | grep chenbychenby                NodePort    10.109.222.0    <none>        80:30971/TCP   5m8s   app=chenbyroot@hello:~# 

演示

在线体验:

https://www.oiox.cn/

https://www.chenby.cn/

https://blog.oiox.cn/

https://www.oiox.cn/

https://www.chenby.cn/

https://blog.oiox.cn/

https://cby-chen.github.io/

https://blog.csdn.net/qq_3392...

https://my.oschina.net/u/3981543

https://www.zhihu.com/people/...

https://segmentfault.com/u/hp...

https://juejin.cn/user/331578...

https://cloud.tencent.com/dev...

https://www.jianshu.com/u/0f8...

https://www.toutiao.com/c/use...

CSDN、GitHub、知乎、开源中国、思否、掘金、简书、腾讯云、今日头条、集体博客、全网可搜《小陈运维》

文章次要公布于微信公众号:《Linux运维交换社区》