Aspire项目发布到远程k8s集群

aspire,k8s · 浏览次数 : 0

小编点评

Sure, here is the generated content: ```yaml apiVersion: v1 kind: ConfigMap metadata: name: rancher-desktop spec: data: # rancher-desktop kube config client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrVENDQVRlZ0F3SUJBZ0lJT2xSMG9ES2pBYVF3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjhHQTFVRUF3d1kKYXpOekxXTnNhV1Z1ZEMxallVQXhOekUxTXpFNE5ERXhNQjRYRFRJME1EVXhNREExTWpBeE1Wb1hEVEkxTURVeApNREExTWpBeE1Wb3dNREVYTUJVR0ExVUVDaE1PYzNsemRHVnRPbTFoYzNSbGNuTXhGVEFUQmdOVkJBTVRESE41CmMzUmxiVHBoWkcxcGJqQlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJEUWhQUVlpSG5xVmpHdVoKc25lQkx6TG5qTHQzYThhVjJXOWhBNnBqV0ppb28ycjhBb1hEaG56ZjlFSG0yWTJnaVIvaU1Takluc01tZ3NwYgpTR1BiRGhpalNEQkdNQTRHQTFVZER3RUIvd1FFQXdJRm9EQVRCZ05WSFNVRUREQUtCZ2dyQmdFRkJRY0RBakFmCkJnTlZIU01FR0RBV2dCUmdSeGtUaVV0a1N4QmpaVHpjdy9pTkpUeDQ4akFLQmdncWhrak9QUVFEQWdOSUFEQkYKQWlCTGQktLS0tLQo= client-key-data: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUlYeHBveFZWcml2VFpCb1J6b0pHTlg2VURad1d1bElKZmc5V2NLQkI3ZGtvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFTkNFOUJpSWVlcFdNYTVteWQ0RXZNdWVNdTNkcnhwWFpiMkVEcW1OWW1LaWphdndDaGNPRwpmTi8wUWViWmphQ0pIK0l4S01pZXd5YUN5bHRJWTlzT0dBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo= ```

正文

前提

你必须会创建aspire项目,不会的请先看微服务新体验之Aspire初体验

Aspirate (Aspir8)

Aspirate 是将aspire项目发布到k8s集群的工具

安装aspirate

dotnet tool install -g aspirate

aspirate 初始化

切换到AppHost项目目录

aspirate init

在host项目中生成aspirate.json,如下

{
  "TemplatePath": null,
  "ContainerSettings": {
    "Registry": "registry.cn-hangzhou.aliyuncs.com",
    "RepositoryPrefix": "shiningrise",
    "Tags": [
      "latest"
    ],
    "Builder": "docker"
  }
}

生成k8s配置文件

aspirate generate

生成配置文件aspirate-state.json

{
  "projectPath": ".",
  "outputPath": "aspirate-output",
  "containerRegistry": "registry.cn-hangzhou.aliyuncs.com",
  "containerImageTags": [
    "latest",
    "v1.0.0"
  ],
  "containerBuilder": "docker",
  "containerRepositoryPrefix": "shiningrise",
  "outputFormat": "kustomize",
  "skipFinalKustomizeGeneration": false,
  "privateRegistryEmail": "aspir8@aka.ms",
  "useCustomNamespace": false,
  "secrets": {
    "salt": "h9xod1BgQWiEbn2R",
    "hash": "BPs8EnmB42iO3gy/g8XpYMHSD4qSMTs2fZIm7cJTQ5Y=",
    "secrets": {}
  },
  "processAllComponents": true
}

生成

aspirate build

Apply Manifests

aspirate apply

选择目标集群

修改svc

切换到AspireApp1.AppHost\aspirate-output\webfrontend

修改service.yaml


apiVersion: apps/v1
kind: Deployment
metadata:
  name: apiservice
  labels:
    app: apiservice
spec:
  minReadySeconds: 60
  replicas: 1
  selector:
    matchLabels:
      app: apiservice
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: apiservice
    spec:
      containers:
      - name: apiservice
        image: registry.cn-hangzhou.aliyuncs.com/shiningrise/apiservice:latest #修改成你的镜像文件
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        - containerPort: 8443
        envFrom:
        - configMapRef:
            name: apiservice-env
      terminationGracePeriodSeconds: 180
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: webfrontend
  labels:
    app: webfrontend
spec:
  minReadySeconds: 60
  replicas: 1
  selector:
    matchLabels:
      app: webfrontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: webfrontend
    spec:
      containers:
      - name: webfrontend
        image: registry.cn-hangzhou.aliyuncs.com/shiningrise/webfrontend:latest # 修改成你的镜像文件
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        - containerPort: 8443
        envFrom:
        - configMapRef:
            name: webfrontend-env
      terminationGracePeriodSeconds: 180

修改配置文件后要重新运行

aspirate apply

增加远程k8s集群到win11本地

打开用户根目录,进入.kube目录(比如我的:C:\Users\shiningrise\.kube)

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJVEdIdXJTek55YnN3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBMU1qWXdOek0wTWpGYUZ3MHpOREExTWpRd056TTVNakZhTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLCkFvSUJBUUMzWWkyQmxyWlRWTXVXSkxuSWJJL1dVWEVUTUZab29kNUFqTFJzU01VbHhIOVp1dDR2TXAzK2U2QWsKMzBiZHFIeXlmajI1dzVIRnRibHNHbGQwWXpqLzFwTFNnNC9KRXU1VVNLdkJMVnA4YStiWmRVQXR6SmlkaFpJQQpzZTBud0IvQ3RTUFp5SEJ2emgwTEgxSVVVR2tJOTlEdUY4KytxZGdFTFNCRXFxbVNHWnVtUGp1K2twc2VIK296CkxYbVUxNkpsUzdTUHNsTjdWalJ6MFVObmh6Nk9ud3NERWhPaWk4SlprMFNJNlRtbmxnSGFHTE1PZ1pTV0tFRWkKdFV6Mkx6QU9IWXBoSlFqZmZuc25wci9aRW1QNStmdE0vaFhtOGpsaWQyL1VKZXFkTHhEZ3BCcEhLT05Yck5MVQord0ZiUFc1bUFlbmc1Z2lMNmVVMCswaXkycGdEQWdNQkFBR2pXVEJYTUE0R0ExVWREd0VCL3dRRUF3SUNwREFQCkJnTlZIUk1CQWY4RUJUQURBUUgvTUIwR0ExVWREZ1FXQkJRZlJKQVJYaXRqQWZqaTY5THk0N1VuOGVWbG9qQVYKQmdOVkhSRUVEakFNZ2dwcmRXSmxjbTVsZEdWek1BMEdDU3FHU0liM0RRRUJDd1VBQTRJQkFRQ0lZZmFtQUdmcAplRlZLYk9aNkF0QXFYSVRNY2dBYW9zTFgwekpSeXVwSFpTYkcrbnVYTmRmeW53Nm5iTGg0L1ltMU9KMkNlRUpGCjRNeW9XTHhla0J3UFk2U3BTeHZScGdLUzM2Z1J1WnZTdXI0cDVCQk1BeHRUZmFwUWJ3dDRtdXNOU3VQN0NWUmIKcUJON1FhWXduTDVOSmk4SHVPMnlzUmx4TjFaWmdlaWN0anRoK2ZxUkhab3UrQnZBbjFvd284NE1talcyRGVnLwp3L3crMGRkNWliNS9ZRGtuVzNEaHJSSWZpNzcvenhTYTFnSW1rVmRCdmdrT0F4TWNEQlo5ZWdTbk03K3UxVy9wCm5WNzYxdDhrbmdxOXVpYVpzU2w2VWVDTitEYkdWYUNFL05LUDdVZVB2WmwrVG11aFdPVVVPbXB3U0RUQ3cxVHQKRHlITzFZOURHOVhECi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: https://kubernetes.docker.internal:6443
  name: docker-desktop
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJTFJrdWNpMURrUFF3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBMU1UZ3dNalE1TlRoYUZ3MHpOREExTVRZd01qVTBOVGhhTUJVeApFekFSQmdOVkJBTVRDbXQxWW1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UZOenZBazhrQmZTcjZjZ1Fra0lECkRtS0ROQm96Tk03SHVkYlR3NkdjREY4eUdVRkxDaDIzRHBkdC9tZmdtZUJzUnRuM3hEK254c3c0eWwybThFUXAKdkp5disyWG5OekxHCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: https://192.168.215.200:6443
  name: kubernetes
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJkekNDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUzTVRVek1UZzBNVEV3SGhjTk1qUXdOVEV3TURVeU1ERXhXaGNOTXpRd05UQTRNRFV5TURFeApXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUzTVRVek1UZzBNVEV3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFUZEVIK0VoeEJ4a1dIQVRqd2R1bXBrcG9ma1owNXdmV2ZlWW5wcHBmclQKTXF4T2hYM2RkL0k2VGFaQmVkR0p3a0xVdTZDSVhiWmpVampCcWU4anFQSWtvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVWcweUZ1bm1HQmoxTHE1UHFUZ2hHCmc1RHBVUGd3Q2dZSUtvWkl6ajBFQXdJRFNBQXdSUUlnV3NxTnZYSWVWemJPdDUwR1BLeUFJZkxIVHJSdGtIZG4KRmtlNkpqeXNDYjBDSVFDc2kwRE5ibzYxNHpQaU5mMGExaC9nbW5YQ3Z0TDBuaXdldW1iZ2J3clNIUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: https://172.31.125.118:6443
  name: rancher-desktop
contexts:
- context:
    cluster: docker-desktop
    user: docker-desktop
  name: docker-desktop
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes
- context:
    cluster: rancher-desktop
    user: rancher-desktop
  name: rancher-desktop
current-context: kubernetes
kind: Config
preferences: {}
users:
- name: docker-desktop
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURRakNDQWlxZ0F3SUJBZ0lJRGVyNmhiZnNlMzR3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBMU1qWXdOek0wTWpGYUZ3MHlOVEExTWpZd056TTVNak5hTURZeApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sc3dHUVlEVlFRREV4SmtiMk5yWlhJdFptOXlMV1JsCmMydDBiM0F3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQ3dLZnl2VEJXNWdkWWQKZWk0QWVMTTIvOThwV21XOVUxcnZ4N3lFSWR1eHNobjdHYVNrTEFyUmJqTm82YjNxQ3F3YXhadlpYaTQ1YjRxSwptSEhIbmtRaFZWS1dBa2pqck1laVQySGdRRGNaR3RzTHNwNkpBZGdYb2J5elJCQ3Jub1RIMVYrWmxRS3c5dVh0Cm8reTI5SytROW1IQlo0SnNSQkRKN0FCdGl1eUlUSzVVRThTMG1mNDNLZm9qVGdXMXErdnozNHIvdWR2TC9XN0sKTFNXL1RWbWhiSjhNeWtTaDVSZGFVZmxuMjVSYllIUGRCZlR3dmZLT0lscm1DY2RqS2J6N1grbDZIejlsSlc4Mwowc1V5OTUyU2dNL1hGTURwMjRZMVNRbnZ4eEdPYXhHb2k4UGEvSkluZHd0alFkaThMVW5BeHNtV0pQeUx6YzViCk5kMURhQ2xYQWdNQkFBR2pkVEJ6TUE0R0ExVWREd0VCL3dRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU1CZ05WSFJNQkFmOEVBakFBTUI4R0ExVWRJd1FZTUJh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nhwWFpiMkVEcW1OWW1LaWphdndDaGNPRwpmTi8wUWViWmphQ0pIK0l4S01pZXd5YUN5bHRJWTlzT0dBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=

这三处来自k8s集群的主机的kube配置文件中

这样添加后就可以选择远程k8s集群了

切换k8s集群命令

kubectl config get-contexts
kubectl config use-context <context-name>
kubectl config current-context

常用命令

docker run -d -p 5000:5000 --privileged=true --restart always -v E:/docker/registry:/var/lib/registry --name registry registry:2
    
dotnet tool install -g aspirate
    
aspirate init
aspirate generate
aspirate build
aspirate apply

aspirate destroy
dotnet tool uninstall -g aspirate

相关文章

作者

吴晓阳 微信号:shiningrise

与Aspire项目发布到远程k8s集群相似的内容:

Aspire项目发布到远程k8s集群

前提 你必须会创建aspire项目,不会的请先看微服务新体验之Aspire初体验 Aspirate (Aspir8) Aspirate 是将aspire项目发布到k8s集群的工具 安装aspirate dotnet tool install -g aspirate aspirate 初始化 切换到A

微服务新体验之Aspire初体验

安装aspire 查看vs版本 我这的版本是17.9.7,不支持aspire,所以需要升级 更新VS 点击 帮助->检查更新 点击更新 静等安装升级 创建aspire项目 项目创建成功,如下图 运行Aspire项目 在AspireApp1.AppHost的launchSettings.json文件中

【译】使用 .NET Aspire 和 Visual Studio 开发云原生应用

我们很高兴地宣布 .NET Aspire 发布,它扩展了 Visual Studio 在云原生应用程序开发方面的能力。.NET Aspire 提供了一个框架和工具,以一种独特的方式,使分布式 .NET 应用程序更容易构建、部署和管理。这种集成旨在使云原生应用程序的开发更加简单和高效。

微软正式发布:.NET Aspire 云原生开发框架

前言 2024年5月22日北京时间,微软正式发布全新的.NET云原生开发框架—.NET Aspire。 .NET Aspire 是一个新的平台无关、语言无关的框架,旨在简化 .NET云原生服务的开发,并且现在已经全面可用,可以在 Visual Studio 2022 17.10、.NET CLI 或

.NET Aspire 正式发布:简化 .NET 云原生开发

.NET团队北京时间2024年5月22日已正式发布.NET Aspire ,在博客文章里做了详细的介绍:.NET Aspire 正式发布:简化 .NET 云原生开发 - .NET 博客 (microsoft.com)[1]。.NET Aspire 是一个新的平台无关、语言无关的框架,旨在简化.NET

.NET ASPIRE 预览版 7 发布

.NET Aspire 预览版 7 并不是原计划的一部分,此预览版有很多重大 API 更改,部分原因是一旦产品发布,我们将致力于稳定的 API 表面。可以说,Aspire团队希望确保在最终发布之前完成这些 API 更改。 但作为开发人员,我们会喜欢能够对快速发展的开发生态系统中的变化做出快速反应。.

.NET Aspire 预览版 6 发布

.NET Aspire 预览版 6 引入了一系列重大更新,主要包括 API 的重大更改、安全性和可靠性的提升、新的资源和组件、应用程序主机的更新、测试支持、模板更新、组件更新、Azure 配置包的更新以及 Azure 开发者 CLI 对多个端点的支持。这些更新旨在提高 .NET Aspire 的性能

Microsoft宣布将在开发人员会议上专注于.NET Aspire

2024年7月15日微软宣布,其开发执行团队将在下个月的开发者大会上聚焦于使用 .NET Aspire 的云原生开发,以及结合人工智能的“现代 SQL”在 Microsoft Fabric 中的应用。微软的 Visual Studio LIVE! 2024 大会不仅是一个会议,而是创新、学习和社区庆

Dapr 与 .NET Aspire 结合使用获得无与伦比的本地开发体验

Dapr 提供了一组构建块,用于抽象分布式系统中常用的概念。这包括服务、缓存、工作流、复原能力、机密管理等之间的安全同步和异步通信。不必自己实现这些功能,可以消除样板,降低复杂性,并允许您专注于开发业务功能。在您的时间有限并且您只想进行实验的情况下,在Dapr初始设置上花费大量时间可能会令人沮丧。更

.NET8中的Microsoft.Extensions.Http.Resilience库

接上一篇,https://www.cnblogs.com/vipwan/p/18129361 借助Aspire中新增的Microsoft.Extensions.ServiceDiscovery库,我们可以很容易的做到服务发现,那么服务节点的熔断限流以及重试等弹性机制.NET是怎么处理的呢? 比如下图