简体   繁体   English

如何编写正确的 yaml 以在 Azure devops 中部署 kubernetes 集群?

[英]How to write correct yaml for deploying kubernetes cluster in Azure devops?

I am trying to establish Dockerized Angular application in azure cloud by using kubernetes but I can not do that.我正在尝试使用 kubernetes 在 azure 云中建立 Dockerized Angular 应用程序,但我不能这样做。 Everything looks fine but I can not see angular application when I enter web url on browser.What is wrong in my Dockerfile or yml files? Everything looks fine but I can not see angular application when I enter web url on browser.What is wrong in my Dockerfile or yml files? Can you give me some advises?你能给我一些建议吗? I made lots of search in 2 days but I didn't find a solution.我在 2 天内进行了很多搜索,但没有找到解决方案。

deployment.yml:部署.yml:


apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: xxx-pod
  name: xxx-deployment
spec:
  replicas: 5
  selector:
    matchLabels:
      app: xxx-pod
  strategy: {}
  template:
    metadata:
     labels:
        app: xxx-pod
    spec:
      containers:
      - image: xxx.azurecr.io/cm-webui:v1
        name: webapp
        imagePullPolicy: Always
        resources: {}
        ports:
          - containerPort: 3080 
status: {}

service.yml:服务.yml:


apiVersion: v1
kind: Service
metadata:
  name: xxx-service
  labels:
    run: xxx-pod
spec:
  selector:
    app: xxx-pod
  ports:
  - port: 3080
    targetPort: 80
  type: LoadBalancer

Dockerfile: Dockerfile:


FROM node:10 AS ui-build
WORKDIR /usr/src/app
COPY my-app/ ./my-app/
RUN cd my-app && npm install @angular/cli && npm install && npm run build

FROM node:10 AS server-build
WORKDIR /root/
COPY --from=ui-build /usr/src/app/my-app/dist ./my-app/dist
COPY package*.json ./
RUN npm install
COPY server.js .

EXPOSE 3080

CMD ["node", "server.js"]

My Logs:我的日志:


8m13s       Normal    EnsuredLoadBalancer            service/xxx-service                    Ensured load balancer
8m17s       Warning   FailedToUpdateEndpoint         endpoints/xxx-service                  Failed to update endpoint default/xxx-service: Operation cannot be fulfilled on endpoints "xxx-service": the object has been modified; please apply your changes to the latest version and try again
8m17s       Warning   FailedToUpdateEndpointSlices   service/xxx-service                    Error updating Endpoint Slices for Service default/xxx-service: failed to update xxx-service-p429q EndpointSlice for Service default/xxx-service: Operation cannot be fulfilled on endpointslices.discovery.k8s.io "xxx-service-p429q": the object has been modified; please apply your changes to the latest version and try again

In the service definition you exchanged port and targetPort values.在服务定义中,您交换了porttargetPort值。 port should be 80 and targetPort 3080. port应该是 80 和targetPort 3080。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Azure Devops 将 Angular 应用程序部署到 NodeJS - Deploying Angular app to NodeJS using Azure Devops 将 Angular + .Net Core 部署到 Azure DevOps VM - Deploying Angular + .Net Core to Azure DevOps VM .NET Core 3 - Angular 模板 - Angular Assets 未通过 DevOps 部署在 Azure 中 - .NET Core 3 - Angular Template - Angular Assets not deploying in Azure via DevOps 部署到 Kubernetes 集群后启动 angular 应用程序时出现 502 bad gateway 错误 - 502 bad gateway error while launching the angular application after deploying to Kubernetes cluster 将 angular 应用程序部署到 Kube.netes 集群后出现 Nginx 502 bad gateway 错误 - Nginx 502 bad gateway error after deploying the angular application to Kubernetes cluster 如何编写正确的 querySelector - How to write a correct querySelector 如何在 ZD18B8624A0F5F721DA7B82356 中使用 Azure devops REST API - How to consume Azure devops REST API in angular Angular 项目 - Azure DevOps - 3 个环境文件。 在 yaml 文件中,我将指定要使用哪个环境文件的变量放在哪里? - Angular project - Azure DevOps - 3 Environment files. In the yaml file, where do I put the variable that designates which environment file to use? 无法识别 Azure Devops Angular - Azure Devops Angular not recognized 上传文件到 azure devops - uploading a file to azure devops
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM