ASCII码 ASCII码

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

发布于:2022-03-16 09:46:01  栏目:技术文档

使用 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
  1. docker@minikube:~$ docker image ls
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. ponponon/test-nameko-for-rabbitmq 1.0.1 eb717d2bfbaa 17 hours ago 1.1GB
  4. nginx latest c919045c4c2b 11 days ago 142MB
  5. registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver v1.23.1 b6d7abedde39 2 months ago 135MB
  6. registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy v1.23.1 b46c42588d51 2 months ago 112MB
  7. registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler v1.23.1 71d575efe628 2 months ago 53.5MB
  8. registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager v1.23.1 f51846a4fd28 2 months ago 125MB
  9. registry.cn-hangzhou.aliyuncs.com/google_containers/etcd 3.5.1-0 25f8c7f3da61 4 months ago 293MB
  10. registry.cn-hangzhou.aliyuncs.com/google_containers/coredns v1.8.6 a4ca41631cc7 5 months ago 46.8MB
  11. registry.cn-hangzhou.aliyuncs.com/google_containers/coredns/coredns v1.8.6 a4ca41631cc7 5 months ago 46.8MB
  12. registry.cn-hangzhou.aliyuncs.com/google_containers/pause 3.6 6270bb605e12 6 months ago 683kB
  13. registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetesui/dashboard v2.3.1 e1482a24335a 8 months ago 220MB
  14. registry.cn-hangzhou.aliyuncs.com/google_containers/dashboard <none> e1482a24335a 8 months ago 220MB
  15. registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetesui/metrics-scraper v1.0.7 7801cfc6d5c0 9 months ago 34.4MB
  16. registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-scraper <none> 7801cfc6d5c0 9 months ago 34.4MB
  17. registry.cn-hangzhou.aliyuncs.com/google_containers/k8s-minikube/storage-provisioner v5 6e38f40d628d 11 months ago 31.5MB
  18. registry.cn-hangzhou.aliyuncs.com/google_containers/storage-provisioner v5 6e38f40d628d 11 months ago 31.5MB
  1. kubectl create -f env-configmap.yaml
  2. ```java
  3. ─➤ kubectl describe configmap env
  4. Name: env
  5. Namespace: default
  6. Labels: io.kompose.service=add-service-env
  7. Annotations: <none>
  8. Data
  9. ====
  10. DATABASE_HOST:
  11. ----
  12. 192.168.31.203
  1. ```java
  2. 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

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

相关推荐
阅读 +