本站支持搜索的镜像仓库:Docker Hub、gcr.io、ghcr.io、quay.io、k8s.gcr.io、registry.gcr.io、elastic.co、mcr.microsoft.com
ASP.NET Core 是由 Microsoft 开发的开源 Web 应用程序开发框架。它既可以在 Windows 上运行于完整的 .NET Framework,也可以跨平台运行于 .NET Core。Bitnami 提供的 ASP.NET Core 镜像经过精心设计和维护,可快速部署到 Kubernetes 集群,适用于生产环境工作负载。
ASP.NET Core 概述
商标说明:本软件列表由 Bitnami 打包。产品中提及的各个商标分别归各自公司所有,使用这些商标并不意味着任何关联或认可。
helm install my-release oci://registry-1.docker.io/bitnamicharts/aspnet-core
使用发布名称 my-release 安装图表:
helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/aspnet-core
这些命令会使用默认配置在 Kubernetes 集群上部署 ASP.NET Core 应用。
提示:使用
helm list命令列出所有发布版本
构建包含 ASP.NET Core 应用的自定义 Docker 镜像,通过覆盖默认镜像参数和设置自定义命令来部署:
appFromExternalRepo.enabled=false image.registry=docker.io image.repository=你的镜像仓库 image.tag=你的镜像标签 command=[命令] args=[参数]
使用 Helm 命令安装:
helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/aspnet-core \ --set appFromExternalRepo.enabled=false \ --set image.registry=docker.io \ --set image.repository=你的镜像仓库 \ --set image.tag=你的镜像标签 \ --set command=[命令] \ --set args=[参数]
此方法使用两个初始化容器:
clone-repository: 使用 Bitnami GIT 镜像下载代码仓库dotnet-publish: 使用 Bitnami .Net SDK 镜像构建/发布 ASP.NET Core 应用启用此功能需设置 appFromExternalRepo.enabled=true 并配置仓库参数:
helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/aspnet-core \ --set appFromExternalRepo.enabled=true \ --set appFromExternalRepo.clone.repository=[***] \ --set appFromExternalRepo.clone.revision=main \ --set appFromExternalRepo.publish.subFolder=应用子文件夹路径 \ --set appFromExternalRepo.startCommand[0]=dotnet \ --set appFromExternalRepo.startCommand[1]=应用入口.dll
示例:部署 OCMinimal 示例应用
helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/aspnet-core \ --set appFromExternalRepo.enabled=true \ --set appFromExternalRepo.clone.repository=[***] \ --set appFromExternalRepo.clone.revision=main \ --set appFromExternalRepo.publish.subFolder=aspnetcore/performance/caching/output/samples/7.x/ \ --set appFromExternalRepo.startCommand[0]=dotnet \ --set appFromExternalRepo.startCommand[1]=OCMinimal.dll
如果已创建包含应用代码的 PVC,可通过以下命令挂载部署:
helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/aspnet-core \ --set appFromExistingPVC.enabled=true \ --set appFromExistingPVC.existingClaim=my-custom-apsnet-core-app
Bitnami 图表允许为部署中的所有容器设置资源请求和限制,通过 resources 参数配置。对于生产工作负载,设置请求至关重要,应根据具体用例进行调整。
图表包含 resourcesPreset 值,可根据不同预设自动设置 resources 部分,但生产环境中建议手动配置以适应特定需求。
在生产环境中强烈建议使用不可变标签,确保部署不会因标签更新而自动更改。Bitnami 会在主容器有新版本、重大更改或关键漏洞时发布新图表更新容器。
要在 Kubernetes 上备份和恢复 Helm 图表部署,需要使用 Velero 工具备份源部署的持久卷并将其附加到新部署。
可通过 extraEnvVars 属性添加额外环境变量:
extraEnvVars: - name: LOG_LEVEL value: error
也可使用包含环境变量的 ConfigMap 或 Secret:
extraEnvVarsCM: "configmap-name" # 包含环境变量的 ConfigMap 名称 extraEnvVarsSecret: "secret-name" # 包含环境变量的 Secret 名称
如需在 ASP.NET Core 应用所在的 Pod 中运行额外容器,可通过 sidecars 参数定义:
sidecars: - name: 容器名称 image: 镜像地址 imagePullPolicy: Always ports: - name: 端口名称 containerPort: 1234
同样,可通过 initContainers 参数添加额外的初始化容器:
initContainers: - name: 容器名称 image: 镜像地址 imagePullPolicy: Always ports: - name: 端口名称 containerPort: 1234
如需部署额外对象(如包含应用配置的 ConfigMap),可使用 extraDeploy 参数:
extraDeploy: |- - apiVersion: v1 kind: ConfigMap metadata: name: aspnet-core-configuration labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 6 }} {{- end }} data: appsettings.json: |- { "AllowedHosts": "*" }
然后挂载到容器中:
extraVolumeMounts: - name: configuration mountPath: /app/config/ readOnly: true extraVolumes: - name: configuration configMap: name: aspnet-core-configuration
可通过 affinity 参数设置自定义亲和性规则:
affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app operator: In values: - aspnet-core topologyKey: "kubernetes.io/hostname"
也可使用预设配置:
podAffinityPreset: "soft" # Pod 亲和性预设 podAntiAffinityPreset: "soft" # Pod 反亲和性预设 nodeAffinityPreset: # 节点亲和性预设 type: "soft" key: "kubernetes.io/os" values: ["linux"]
如需启用 Ingress 集成,请将 ingress.enabled 设置为 true:
ingress: enabled: true hostname: aspnet.example.com annotations: kubernetes.io/ingress.class: nginx cert-manager.io/cluster-issuer: letsencrypt-prod tls: true
可通过 ingress.extraHosts 添加多个主机:
ingress: enabled: true hostname: aspnet.example.com extraHosts: - name: aspnet-admin.example.com path: /admin extraTLS: - hosts: - aspnet-admin.example.com secretName: aspnet-admin-tls
| 参数名 | 描述 | 默认值 |
|---|---|---|
global.imageRegistry | 全局 Docker 镜像仓库 | "" |
global.imagePullSecrets | 全局 Docker 仓库密钥数组 | [] |
global.defaultStorageClass | 持久卷的全局默认存储类 | "" |
global.storageClass | 已弃用:使用 global.defaultStorageClass 替代 | "" |
global.security.allowInsecureImages | 允许跳过镜像验证 | false |
global.compatibility.openshift.adaptSecurityContext | 调整安全上下文以兼容 OpenShift | auto |
| 参数名 | 描述 | 默认值 |
|---|---|---|
kubeVersion | 覆盖 Kubernetes 版本 | "" |
nameOverride | 部分覆盖 aspnet-core.fullname | "" |
fullnameOverride | 完全覆盖 aspnet-core.fullname | "" |
namespaceOverride | 覆盖命名空间 | "" |
commonLabels | 添加到所有部署对象的标签 | {} |
commonAnnotations | 添加到所有部署对象的注解 | {} |
clusterDomain | Kubernetes 集群域名 | cluster.local |
extraDeploy | 随发布一起部署的额外对象数组 | [] |
| 参数名 | 描述 | 默认值 |
|---|---|---|
image.registry | ASP.NET Core 镜像仓库 | REGISTRY_NAME |
image.repository | ASP.NET Core 镜像仓库路径 | REPOSITORY_NAME/aspnet-core |
image.digest | 镜像摘要,设置后将覆盖标签 | "" |
image.pullPolicy | 镜像拉取策略 | IfNotPresent |
image.pullSecrets | 镜像拉取密钥 | [] |
image.debug | 启用镜像调试模式 | false |
command | 覆盖默认容器命令 | [] |
args | 覆盖默认容器参数 | [] |
bindURLs | 绑定的 URL | [***] |
extraEnvVars | 额外环境变量 | [] |
extraEnvVarsCM | 包含额外环境变量的 ConfigMap | "" |
extraEnvVarsSecret | 包含额外环境变量的 Secret | "" |
| 参数名 | 描述 | 默认值 |
|---|---|---|
replicaCount | 部署副本数 | 1 |
schedulerName | 调度器名称 | "" |
priorityClassName | Pod 优先级类名称 | "" |
topologySpreadConstraints | Pod 拓扑分布约束 | [] |
automountServiceAccountToken | 挂载服务账户令牌 | false |
hostAliases | Pod 主机别名 | [] |
extraVolumes | 额外卷 | [] |
extraVolumeMounts | 额外卷挂载 | [] |
sidecars | 边车容器 | [] |
initContainers | 初始化容器 | [] |
lifecycleHooks | 生命周期钩子 | {} |
podAnnotations | Pod 注解 | {} |
podLabels | Pod 标签 | {} |
updateStrategy.type | 部署策略类型 | RollingUpdate |
podAffinityPreset | Pod 亲和性预设 | "" |
podAntiAffinityPreset | Pod 反亲和性预设 | soft |
nodeAffinityPreset.type | 节点亲和性预设类型 | "" |
自 2025 年 8 月 28 日起,Bitnami 将改进其公共目录,在新的 Bitnami Secure Images 计划 下提供精选的强化安全聚焦镜像。作为此过渡的一部分:
这些变更旨在通过推广软件供应链完整性和最新部署的最佳实践,提高所有 Bitnami 用户的安全态势。更多详情,请访问 Bitnami Secure Images 公告。
免费版仅支持 Docker Hub 加速,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
免费版仅支持 docker.io;专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录方式配置轩辕镜像加速服务,包含7个详细步骤
在 Linux 系统上配置轩辕镜像源,支持主流发行版
在 Docker Desktop 中配置轩辕镜像加速,适用于桌面系统
在 Docker Compose 中使用轩辕镜像加速,支持容器编排
在 k8s 中配置 containerd 使用轩辕镜像加速
在宝塔面板中配置轩辕镜像加速,提升服务器管理效率
在 Synology 群晖NAS系统中配置轩辕镜像加速
在飞牛fnOS系统中配置轩辕镜像加速
在极空间NAS中配置轩辕镜像加速
在爱快ikuai系统中配置轩辕镜像加速
在绿联NAS系统中配置轩辕镜像加速
在威联通NAS系统中配置轩辕镜像加速
在 Podman 中配置轩辕镜像加速,支持多系统
配置轩辕镜像加速9大主流镜像仓库,包含详细配置步骤
无需登录即可使用轩辕镜像加速服务,更加便捷高效
需要其他帮助?请查看我们的 常见问题 或 官方QQ群: 13763429