13 将项目打包到k8s中
13.1 将项目进行打包
参考: docker 入门到实战(九)springboot 打包到docker
将项目传到阿里云:docker 入门到实战(八)本地镜像发布到阿里云
使用k8s部署镜像
#导出yamlkubectl create deployment hello --image=registry.cn-shanghai.aliyuncs.com/remzhi/hello:latest --dry-run -o yaml > hello.yaml#运行yamlkubectl apply -f hello.yaml#创建service NodePort 对外访问kubectl expose deployment hello --port=8080 --target-port=8080 --type=NodePort
apiVersion: apps/v1kind: Deploymentmetadata:creationTimestamp: nulllabels:app: helloname: hellospec:replicas: 1selector:matchLabels:app: hellostrategy: {}template:metadata:creationTimestamp: nulllabels:app: hellospec:containers:- image: registry.cn-shanghai.aliyuncs.com/remzhi/hello:latestname: helloresources: {}status: {}


