Aspire项目发布到远程k8s集群

本文涉及的产品
容器服务 Serverless 版 ACK Serverless,317元额度 多规格
容器服务 Serverless 版 ACK Serverless,952元额度 多规格
简介: Aspire项目发布到远程k8s集群

前提

你必须会创建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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJVEdIdXJTek55YnN3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBMU1qWXdOek0wTWpGYUZ3MHpOREExTWpRd056TTVNakZhTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLCkFvSUJBUUMzWWkyQmxyWlRWTXVXSkxuSWJJL1dVWEVUTUZab29kNUFqTFJzU01VbHhIOVp1dDR2TXAzK2U2QWsKMzBiZHFIeXlmajI1dzVIRnRibHNHbGQwWXpqLzFwTFNnNC9KRXU1VVNLdkJMVnA4YStiWmRVQXR6SmlkaFpJQQpzZTBud0IvQ3RTUFp5SEJ2emgwTEgxSVVVR2tJOTlEdUY4KytxZGdFTFNCRXFxbVNHWnVtUGp1K2twc2VIK296CkxYbVUxNkpsUzdTUHNsTjdWalJ6MFVObmh6Nk9ud3NERWhPaWk4Slpr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BWldxY0VBRHRuc1FLZWE2aHZwanpmQWJjZUFuUgoyREcyWnYrTGVWTnBCMUlsU3kways5Ritia3JxSUtYSWVodHVoYThCZ3craUZOenZBazhrQmZTcjZjZ1Fra0lECkRtS0ROQm96Tk03SHVkYlR3NkdjREY4eUdVRkxDaDIzRHBkdC9tZmdtZUJzUnRuM3hEK254c3c0eWwybThFUXAKdkp5disyWG5OekxHCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURRakNDQWlxZ0F3SUJBZ0lJRGVyNmhiZnNlMzR3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBMU1qWXdOek0wTWpGYUZ3MHlOVEExTWpZd056TTVNak5hTURZeApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sc3dHUVlEVlFRREV4SmtiMk5yWlhJdFptOXlMV1JsCmMydDBiM0F3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQ3dLZnl2VEJXNWdkWWQKZWk0QWVMTTIvOThwV21XOVUxcnZ4N3lFSWR1eHNobjdHYVNrTEFyUmJqTm82YjNxQ3F3YXhadlpYaTQ1YjRxSwptSEhIbmtRaFZWS1dBa2pqck1laVQySGdRRGNaR3RzTHNwNkpBZGdYb2J5elJCQ3Jub1RIMVYrWmxRS3c5dVh0Cm8reTI5SytROW1IQlo0SnNSQkRKN0FCdGl1eUlUSzVVRThTMG1mNDNLZm9qVGdXMXErdnozNHIvdWR2TC9XN0sKTFNXL1RWbWhiSjhNeWtTaDVSZGFVZmxuMjVSYllIUGRCZlR3dmZLT0lscm1DY2RqS2J6N1grbDZIejlsSlc4Mwowc1V5OTUyU2dNL1hGTURwMjRZMVNRbnZ4eEdPYXhHb2k4UGEvSkluZHd0alFkaThMVW5BeHNtV0pQeUx6YzViCk5kMURhQ2xYQWdNQkFBR2pkVEJ6TUE0R0ExVWREd0V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d1bElKZmc5V2NLQkI3ZGtvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFTkNFOUJpSWVlcFdNYTVteWQ0RXZNdWVNdTNkcnhwWFpiMkVEcW1OWW1LaWphdndDaGNPRwpmTi8wUWViWmphQ0pIK0l4S01pZXd5YUN5bHRJWTlzT0dBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=

这三处来自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

相关实践学习
通过Ingress进行灰度发布
本场景您将运行一个简单的应用,部署一个新的应用用于新的发布,并通过Ingress能力实现灰度发布。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
目录
相关文章
|
25天前
|
JSON Kubernetes 容灾
ACK One应用分发上线:高效管理多集群应用
ACK One应用分发上线,主要介绍了新能力的使用场景
|
26天前
|
Kubernetes 持续交付 开发工具
ACK One GitOps:ApplicationSet UI简化多集群GitOps应用管理
ACK One GitOps新发布了多集群应用控制台,支持管理Argo CD ApplicationSet,提升大规模应用和集群的多集群GitOps应用分发管理体验。
|
1月前
|
Kubernetes 应用服务中间件 nginx
搭建Kubernetes v1.31.1服务器集群,采用Calico网络技术
在阿里云服务器上部署k8s集群,一、3台k8s服务器,1个Master节点,2个工作节点,采用Calico网络技术。二、部署nginx服务到k8s集群,并验证nginx服务运行状态。
505 1
|
1月前
|
Kubernetes Cloud Native 微服务
微服务实践之使用 kube-vip 搭建高可用 Kubernetes 集群
微服务实践之使用 kube-vip 搭建高可用 Kubernetes 集群
107 1
|
1月前
|
Kubernetes Ubuntu Linux
Centos7 搭建 kubernetes集群
本文介绍了如何搭建一个三节点的Kubernetes集群,包括一个主节点和两个工作节点。各节点运行CentOS 7系统,最低配置为2核CPU、2GB内存和15GB硬盘。详细步骤包括环境配置、安装Docker、关闭防火墙和SELinux、禁用交换分区、安装kubeadm、kubelet、kubectl,以及初始化Kubernetes集群和安装网络插件Calico或Flannel。
145 0
|
1月前
|
Kubernetes Cloud Native 流计算
Flink-12 Flink Java 3分钟上手 Kubernetes云原生下的Flink集群 Rancher Stateful Set yaml详细 扩容缩容部署 Docker容器编排
Flink-12 Flink Java 3分钟上手 Kubernetes云原生下的Flink集群 Rancher Stateful Set yaml详细 扩容缩容部署 Docker容器编排
74 0
|
1月前
|
弹性计算 Kubernetes Linux
如何使用minikube搭建k8s集群
如何使用minikube搭建k8s集群
|
存储 Kubernetes API
在K8S集群中,如何正确选择工作节点资源大小? 2
在K8S集群中,如何正确选择工作节点资源大小?
|
Kubernetes Serverless 异构计算
基于ACK One注册集群实现IDC中K8s集群以Serverless方式使用云上CPU/GPU资源
在前一篇文章《基于ACK One注册集群实现IDC中K8s集群添加云上CPU/GPU节点》中,我们介绍了如何为IDC中K8s集群添加云上节点,应对业务流量的增长,通过多级弹性调度,灵活使用云上资源,并通过自动弹性伸缩,提高使用率,降低云上成本。这种直接添加节点的方式,适合需要自定义配置节点(runtime,kubelet,NVIDIA等),需要特定ECS实例规格等场景。同时,这种方式意味您需要自行
基于ACK One注册集群实现IDC中K8s集群以Serverless方式使用云上CPU/GPU资源
|
Kubernetes API 调度
在K8S集群中,如何正确选择工作节点资源大小?1
在K8S集群中,如何正确选择工作节点资源大小?