微服務實踐Aspire專案釋出到遠端k8s叢集

shiningrise發表於2024-06-01

前提

你必須會建立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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJTFJrdWNpMURrUFF3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBMU1UZ3dNalE1TlRoYUZ3MHpOREExTVRZd01qVTBOVGhhTUJVeApF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ia3JxSUtYSWVodHVoYThCZ3craUZOenZBazhrQmZTcjZjZ1Fra0lECkRtS0ROQm96Tk03SHVkYlR3NkdjREY4eUdVRkxDaDIzRHBkdC9tZmdtZUJzUnRuM3hEK254c3c0eWwybThFUXAKdkp5disyWG5OekxHCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURRakNDQWlxZ0F3SUJBZ0lJRGVyNmhiZnNlMzR3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBMU1qWXdOek0wTWpGYUZ3MHlOVEExTWpZd056TTVNak5hTURZeApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sc3dHUVlEVlFRREV4SmtiMk5yWlhJdFptOXlMV1JsCmMydDBiM0F3Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQ3dLZnl2VEJXNWdkWWQKZWk0QWVMTTIvOThwV21XOVUxcnZ4N3lFSWR1eHNobjdHYVNrTEFyUmJqTm82YjNxQ3F3YXhadlpYaTQ1YjRxSwptSEhIbmtRaFZWS1dBa2pqck1laVQySGdRRGNaR3RzTHNwNkpBZGdYb2J5elJCQ3Jub1RIMVYrWmxRS3c5dVh0Cm8reTI5SytROW1IQlo0SnNSQkRKN0FCdGl1eUlUSzVVRThTMG1mNDNLZm9qVGdXMXErdnozNHIvdWR2TC9XN0sKTFNXL1RWbWhiSjhNeWtTaDVSZGFVZmxuMjVSYllIUGRCZlR3dmZLT0lscm1DY2RqS2J6N1grbDZIejlsSlc4Mwowc1V5OTUyU2dNL1hGTURwMjRZMVNRbnZ4eEdPYXhHb2k4UGEvSkluZHd0alFkaThMVW5BeHNtV0pQeUx6YzViCk5kMURhQ2xYQWdNQkFBR2pkVEJ6TUE0R0ExVWREd0VCL3dRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU1CZ05WSFJNQkFmOEVBak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NYTVteWQ0RXZNdWVNdTNkcnhwWFpiMkVEcW1OWW1LaWphdndDaGNPRwpmTi8wUWViWmphQ0pIK0l4S01pZXd5YUN5bHRJWTlzT0dBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=

這三處來自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

相關文章

  • https://github.com/prom3theu5/aspirational-manifests

作者

吳曉陽 微訊號:shiningrise

相關文章