gpt4 book ai didi

docker - 如何更新部署到Kubernetes(EKS)的应用程序代码?

转载 作者:行者123 更新时间:2023-12-02 21:13:31 27 4
gpt4 key购买 nike

我已经使用EKS https://github.com/kubernetes/examples/tree/master/guestbook-go为 guest 应用程序配置了集群

并遵循了官方教程
https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html

假设我要修改public/index.html文件。在Docker文件中,我可以看到该文件已复制到容器中:
COPY ./public/index.html public/index.html
guestbook-controller.json中,我可以看到它所使用的图像:"image":"k8s.gcr.io/guestbook:v3",
修改index.html和部署此新版本的正确方法是什么?
我需要重建这张图片吗?那么,在哪里上传它以及如何在AWS上使用kubernetes工具进行部署呢?

非常感谢,作为Kubernetes的新手,正在寻找学习它的好步骤

最佳答案

以下是在较高级别上使用新镜像设置新应用程序的步骤。

  1. Do a git clone of the repository.

  2. Modify the public/index.html locally.

  3. Do a Docker build using docker build ....

  4. Push the image to a registry (https://hub.docker.com/ or https://cloud.google.com/container-registry/ or some where else). The command depends on the registry. Also, make sure that the image is public.

  5. Update the image appropriately in guestbook-controller.json.

  6. Follow the steps as mentioned in the README.md.


如果要在已经运行的现有K8S应用程序中更新镜像,则必须按照 here进行滚动更新。
仅供引用.....无需创建图像,也可以通过将新的index.html复制到所有正在运行的Pod进行修改,如 here所示。
仅供引用.....该示例使用了过时的 ReplicationController(在guestbook-controller.json中提到),推荐使用 Deployment

关于docker - 如何更新部署到Kubernetes(EKS)的应用程序代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52731573/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com