一、准备条件

确保kubernetes可以访问:reg.yunwei.edu镜像库(vim /etc/hosts)
 
需要准备镜像:
 

[root@cicd sock-shop]# cat complete-demo.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: carts-db
labels:
name: carts-db
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: carts-db
spec:
containers:
- name: carts-db
image: reg.yunwei.edu/sock-shop/mongo
ports:
- name: mongo
containerPort:
securityContext:
capabilities:
drop:
- all
add:
- CHOWN
- SETGID
- SETUID
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: carts-db
labels:
name: carts-db
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: carts-db
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: carts
labels:
name: carts
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: carts
spec:
containers:
- name: carts
image: reg.yunwei.edu/sock-shop/carts:0.4.
ports:
- containerPort:
env:
- name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom
securityContext:
runAsNonRoot: true
runAsUser:
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: carts
labels:
name: carts
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: carts
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: catalogue-db
labels:
name: catalogue-db
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: catalogue-db
spec:
containers:
- name: catalogue-db
image: reg.yunwei.edu/sock-shop/catalogue-db:0.3.
env:
- name: MYSQL_ROOT_PASSWORD
value: fake_password
- name: MYSQL_DATABASE
value: socksdb
ports:
- name: mysql
containerPort:
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: catalogue-db
labels:
name: catalogue-db
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: catalogue-db
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: catalogue
labels:
name: catalogue
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: catalogue
spec:
containers:
- name: catalogue
image: reg.yunwei.edu/sock-shop/catalogue:0.3.
ports:
- containerPort:
securityContext:
runAsNonRoot: true
runAsUser:
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: catalogue
labels:
name: catalogue
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: catalogue
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: front-end
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: front-end
spec:
containers:
- name: front-end
image: reg.yunwei.edu/sock-shop/front-end:0.3.
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort:
securityContext:
runAsNonRoot: true
runAsUser:
capabilities:
drop:
- all
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: front-end
labels:
name: front-end
namespace: sock-shop
spec:
type: NodePort
ports:
- port:
targetPort:
nodePort:
selector:
name: front-end
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: orders-db
labels:
name: orders-db
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: orders-db
spec:
containers:
- name: orders-db
image: reg.yunwei.edu/sock-shop/mongo
ports:
- name: mongo
containerPort:
securityContext:
capabilities:
drop:
- all
add:
- CHOWN
- SETGID
- SETUID
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: orders-db
labels:
name: orders-db
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: orders-db
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: orders
labels:
name: orders
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: orders
spec:
containers:
- name: orders
image: reg.yunwei.edu/sock-shop/orders:0.4.
env:
- name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom
ports:
- containerPort:
securityContext:
runAsNonRoot: true
runAsUser:
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: orders
labels:
name: orders
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: orders
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: payment
labels:
name: payment
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: payment
spec:
containers:
- name: payment
image: reg.yunwei.edu/sock-shop/payment:0.4.
ports:
- containerPort:
securityContext:
runAsNonRoot: true
runAsUser:
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: payment
labels:
name: payment
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: payment
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: queue-master
labels:
name: queue-master
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: queue-master
spec:
containers:
- name: queue-master
image: reg.yunwei.edu/sock-shop/queue-master:0.3.
ports:
- containerPort:
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: queue-master
labels:
name: queue-master
annotations:
prometheus.io/path: "/prometheus"
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: queue-master
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: rabbitmq
labels:
name: rabbitmq
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: rabbitmq
spec:
containers:
- name: rabbitmq
image: reg.yunwei.edu/sock-shop/rabbitmq:3.6.
ports:
- containerPort:
securityContext:
capabilities:
drop:
- all
add:
- CHOWN
- SETGID
- SETUID
- DAC_OVERRIDE
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
labels:
name: rabbitmq
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: rabbitmq
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: shipping
labels:
name: shipping
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: shipping
spec:
containers:
- name: shipping
image: reg.yunwei.edu/sock-shop/shipping:0.4.
env:
- name: ZIPKIN
value: zipkin.jaeger.svc.cluster.local
- name: JAVA_OPTS
value: -Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom
ports:
- containerPort:
securityContext:
runAsNonRoot: true
runAsUser:
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: shipping
labels:
name: shipping
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: shipping
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: user-db
labels:
name: user-db
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: user-db
spec:
containers:
- name: user-db
image: reg.yunwei.edu/sock-shop/user-db:0.4.
ports:
- name: mongo
containerPort:
securityContext:
capabilities:
drop:
- all
add:
- CHOWN
- SETGID
- SETUID
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp-volume
volumes:
- name: tmp-volume
emptyDir:
medium: Memory
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: user-db
labels:
name: user-db
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: user-db
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: user
labels:
name: user
namespace: sock-shop
spec:
replicas:
template:
metadata:
labels:
name: user
spec:
containers:
- name: user
image: reg.yunwei.edu/sock-shop/user:0.4.
ports:
- containerPort:
env:
- name: MONGO_HOST
value: user-db:
securityContext:
runAsNonRoot: true
runAsUser:
capabilities:
drop:
- all
add:
- NET_BIND_SERVICE
readOnlyRootFilesystem: true
nodeSelector:
beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
name: user
labels:
name: user
namespace: sock-shop
spec:
ports:
# the port that this service should serve on
- port:
targetPort:
selector:
name: user

下载镜像文件

二、部署微服务

 
编辑complete-demo.yaml后,执行
#kubectl apply -f complete-demo.yaml
 
查看前端service的访问端口:
#kubectl get service -n sock-shop
 

三、登录浏览器验证(集群节点ip+端口:192.168.42.121:30001)

kubernets部署sock-shop微服务电商平台(11)的更多相关文章

  1. 第11篇Kubernetes部署微服务电商平台

        kubernetes部署sock-shop微服务电商平台: 准备条件   确保kubernetes可以访问:reg.yunwei.edu镜像库   需要准备镜像:       部署微服务   ...

  2. kubernets部署微服务电商平台

    一.准备条件 1) 确保kubernetes可以访问:reg.yunwei.edu镜像库(vim /etc/hosts) [root@cicd yml]# cat /etc/hosts 127.0.0 ...

  3. Kubernetes 部署微服务电商平台(16)

    一.概念 微服务就是很小的服务,小到一个服务只对应一个单一的功能,只做一件事.这个服务可以单独部署运行,服务之间可以通过RPC来相互交互,每个微服务都是由独立的小团队开发,测试,部署,上线,负责它的整 ...

  4. Kubernetes第十一章--部署微服务电商平台

  5. 通过Dapr实现一个简单的基于.net的微服务电商系统(十三)——istio+dapr构建多运行时服务网格之生产环境部署

    之前所有的演示都是在docker for windows上进行部署的,没有真正模拟生产环境,今天我们模拟真实环境在公有云上用linux操作如何实现istio+dapr+电商demo的部署. 目录:一. ...

  6. ASP.NET Core基于K8S的微服务电商案例实践--学习笔记

    摘要 一个完整的电商项目微服务的实践过程,从选型.业务设计.架构设计到开发过程管理.以及上线运维的完整过程总结与剖析. 讲师介绍 产品需求介绍 纯线上商城 线上线下一体化 跨行业 跨商业模式 从0开始 ...

  7. 14 微服务电商【黑马乐优商城】:day06-了解vue-router和webpack的使用

    本项目的笔记和资料的Download,请点击这一句话自行获取. day01-springboot(理论篇) :day01-springboot(实践篇) day02-springcloud(理论篇一) ...

  8. 14 微服务电商【黑马乐优商城】:day04-项目搭建(一)

    本项目的笔记和资料的Download,请点击这一句话自行获取. day01-springboot(理论篇) :day01-springboot(实践篇) day02-springcloud(理论篇一) ...

  9. 14 微服务电商【黑马乐优商城】:day02-springcloud(搭建Eureka注册中心)

    本项目的笔记和资料的Download,请点击这一句话自行获取. day01-springboot(理论篇) :day01-springboot(实践篇) day02-springcloud(理论篇一) ...

随机推荐

  1. PHP通过iconv将字符串从GBK转换为UTF8字符集

    PHP通过iconv将字符串从GBK转换为UTF8字符集的方法,需要的朋友可以参考下. 1. iconv()介绍 iconv函数可以将一种已知的字符集文件转换成另一种已知的字符集文件.例如:从GB23 ...

  2. selenium 模拟键盘事件 复制粘贴、右键、回车等

    #coding=utf-8 ''' selenium ''' from selenium import webdriver as wd import time bc=wd.Chrome(executa ...

  3. PHP--极光推送

    /* * @param * @param 系统通知type为1 * @param 聊天消息 type为2 * @param 提醒付款 接单者确认订单 接单者取消订单 接单 type 为3 * @par ...

  4. 记录一下关于DQN的想法

    下载了几份代码,就两份没有报错通过了 DQN玩FlappyBird https://github.com/yenchenlin/DeepLearningFlappyBird DQN玩Cartpole ...

  5. c#winform多线程感想

    我很菜所以好好学!!! 最近在做一个关于识别的项目,手动识别和自动识别,为了更好的保证自动识别不会引起界面的卡顿等现象,所以简单的学习了一下多线程,也只是入门但还是记录一下. 一.首先了解一下用多线程 ...

  6. Pandas to_sql TypeError: sequence item 0: expected str instance, dict found

    问题介绍 打印了一下数据格式,并未发现问题.如果说是字典实例引起的. 我猜测也是extra字段引起的,因为extra字段是一个json字段.根据网上的提示要对这样的格式进行强转str. 其他发现:pd ...

  7. 使用谷歌chrome浏览器查看任何标签的固有属性

    查看任何标签的固有属性property: 使用谷歌浏览器:Ctrl+Shift+I 开发者工具----点击Elements----点击a标签----点击Properties属性及其属性值. 自定义属性 ...

  8. Invalid HTTP_HOST header: 'xxx.xxx:8000'. You may need to add 'xxx.xx' to ALLOWED_HOSTS

    用python3 manage.py runserver 0.0.0.0:8000命令运行django程序后,通过浏览器访问服务器网址的8000端口,出现访问错误,报错为 Invalid HTTP_H ...

  9. Start Failed, Internal error: recovering IDE to the working state after the critical startup error

    Start Failed, Internal error: recovering IDE to the working state after the critical startup error F ...

  10. MySQL 锁(lock与latch)

    一.什么是锁 锁机制用于管理对共享资源的并发访问,它是数据库系统区别于文件系统的一个关键特性. 数据库系统使用锁是为了支持对共享资源的并发访问,提供数据的完整性和一致性. InnoDB存储引擎锁的实现 ...