博客列表 >开发方式的变化:docker-compose 迁移到 minikube

开发方式的变化:docker-compose 迁移到 minikube

P粉962186587
P粉962186587原创
2022年03月19日 17:29:31909浏览

使用 kompose 转义

下载安装 kompose:地址

有各种各样的版本供你选择,总有一款适合你

注意:新版本的 kompose 砍掉了 up 和 down 两个子命令,以前很多关于 kompose 把 docker-compose 项目直接迁移到 k8s 平台的教程都没有办法使用了

具体情况参考:如何解决 unknown command “up” for “kompose”

输入 kompose convert

使用

  1. kubectl apply -f authentication-service-deployment.yaml,http-api-service-deployment.yaml,add-service-deployment.yaml
  1. kubectl apply -f add-service-service.yaml,authentication-service-service.yaml,http-api-service-service.yaml
  1. kubectl get pods -A
  1. minikube image load ponponon/test-nameko-for-rabbitmq:1.0.1
  1. minikube ssh
  2. ``````java
  3. docker@minikube:~$ docker image ls
  4. REPOSITORY TAG IMAGE ID CREATED SIZE
  5. ponponon/test-nameko-for-rabbitmq 1.0.1 eb717d2bfbaa 17 hours ago 1.1GB
  6. nginx latest c919045c4c2b 11 days ago 142MB
  7. registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver v1.23.1 b6d7abedde39 2 months ago 135MB
  8. registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy v1.23.1 b46c42588d51 2 months ago 112MB
  9. registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler v1.23.1 71d575efe628 2 months ago 53.5MB
  10. registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager v1.23.1 f51846a4fd28 2 months ago 125MB
  11. registry.cn-hangzhou.aliyuncs.com/google_containers/etcd 3.5.1-0 25f8c7f3da61 4 months ago 293MB
  12. registry.cn-hangzhou.aliyuncs.com/google_containers/coredns v1.8.6 a4ca41631cc7 5 months ago 46.8MB
  13. registry.cn-hangzhou.aliyuncs.com/google_containers/coredns/coredns v1.8.6 a4ca41631cc7 5 months ago 46.8MB
  14. registry.cn-hangzhou.aliyuncs.com/google_containers/pause 3.6 6270bb605e12 6 months ago 683kB
  15. registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetesui/dashboard v2.3.1 e1482a24335a 8 months ago 220MB
  16. registry.cn-hangzhou.aliyuncs.com/google_containers/dashboard <none> e1482a24335a 8 months ago 220MB
  17. registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetesui/metrics-scraper v1.0.7 7801cfc6d5c0 9 months ago 34.4MB
  18. registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-scraper <none> 7801cfc6d5c0 9 months ago 34.4MB
  19. registry.cn-hangzhou.aliyuncs.com/google_containers/k8s-minikube/storage-provisioner v5 6e38f40d628d 11 months ago 31.5MB
  20. registry.cn-hangzhou.aliyuncs.com/google_containers/storage-provisioner v5 6e38f40d628d 11 months ago 31.5MB
  1. kubectl create -f env-configmap.yaml
  1. ─➤ kubectl describe configmap env
  2. Name: env
  3. Namespace: default
  4. Labels: io.kompose.service=add-service-env
  5. Annotations: <none>
  6. Data
  7. ====
  8. DATABASE_HOST:
  9. ----
  10. 192.168.31.203
  1. kubectl apply -f authentication-service-deployment.yaml,http-api-service-deployment.yaml,add-service-deployment.yaml
  1. ─➤ kubectl get deployment,svc,pods
  2. NAME READY UP-TO-DATE AVAILABLE AGE
  3. deployment.apps/add-service 1/1 1 1 15m
  4. deployment.apps/authentication-service 1/1 1 1 15m
  5. deployment.apps/http-api-service 1/1 1 1 15m
  6. NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
  7. service/authentication-service ClusterIP 10.99.60.205 <none> 5002/TCP 29h
  8. service/http-api-service ClusterIP 10.104.237.146 <none> 5000/TCP 29h
  9. service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 29h
  10. NAME READY STATUS RESTARTS AGE
  11. pod/add-service-79949489f7-kjm4m 1/1 Running 0 15m
  12. pod/authentication-service-786df44c64-mjhtg 1/1 Running 0 15m
  13. pod/http-api-service-5d6dd96ffb-2btxx 1/1 Running 0 15m

以上就是全部内容。希望对大家有所帮助,

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议