在基于AWS EC2的云端k8s环境中 搭建开发基础设施

中间件下载使用helm,这里部署的都是单机版的

aws-ebs-storageclass.yaml

bash 复制代码
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: aws-ebs-storageclass
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2  # 选择合适的 EBS 类型,如 gp2、io1、gp3 等
  encrypted: "false"  # 是否加密卷,默认为 false
  kmskeyid: ""  # 如果使用 KMS 加密,则指定 KMS key ID
reclaimPolicy: Delete  # 当 PersistentVolume 被删除时的回收策略,默认为 Delete
volumeBindingMode: WaitForFirstConsumer  # 在绑定到 Pod 之前等待卷绑定,默认为 Immediate
allowVolumeExpansion: true  # 允许扩展 PersistentVolumeClaim

my-ingress.yaml

bash 复制代码
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-ingress
spec:
  # defaultBackend:
  #   resource:
  #     apiGroup: k8s.example.com
  #     kind: StorageBucket
  #     name: static-assets
  #指定ingress控制器类型为nginx,不同的控制器表示不一样,可以查看官方文档进行查阅
  ingressClassName: nginx
  rules:
  #指定请求的域名
  - host: www.xxx.com
    http:
      paths:
      #指定请求的路径
      - path: /
        pathType: Prefix
        backend:
          #指定要暴露的应用(Pod)的service,所以使用ingress之前是一定要先创建service的,它是基于service来发现这一组要被请求的pod的
          service:
            name: web
            #指定要暴露的service的内部port端口
            port:
              number: 80
  #指定请求的域名
  - host: dash.xxx.com
    http:
      paths:
      #指定请求的路径
      - path: /
        pathType: Prefix
        backend:
          #指定要暴露的应用(Pod)的service,所以使用ingress之前是一定要先创建service的,它是基于service来发现这一组要被请求的pod的
          service:
            name: dashboard
            #指定要暴露的service的内部port端口
            port:
              number: 80
  #指定请求的域名
  - host: api.xxx.com
    http:
      paths:
      #指定请求的路径
      - path: /
        pathType: Prefix
        backend:
          #指定要暴露的应用(Pod)的service,所以使用ingress之前是一定要先创建service的,它是基于service来发现这一组要被请求的pod的
          service:
            name: api
            #指定要暴露的service的内部port端口
            port:
              number: 17176

mysql-value.yaml

bash 复制代码
global:
  storageClass: "aws-ebs-storageclass"  # 根据您的环境选择存储类
image:
  registry: docker.io
  repository: bitnami/mysql
  tag: 8.4.3-debian-12-r0
  #tag: 8.0.23-debian-10-r0
  ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
  pullPolicy: IfNotPresent
## @param architecture MySQL architecture (`standalone` or `replication`)
##
architecture: standalone
auth:
  ## @param auth.rootPassword Password for the `root` user. Ignored if existing secret is provided
  rootPassword: '123456'
  ## @param auth.createDatabase Whether to create the .Values.auth.database or not
  ## ref: https://github.com/bitnami/containers/tree/main/bitnami/mysql#creating-a-database-on-first-run
  ##
  createDatabase: true
  ## @param auth.database Name for a custom database to create
  ## ref: https://github.com/bitnami/containers/tree/main/bitnami/mysql#creating-a-database-on-first-run
  ##
  database: "mydatabase"
  ## @param auth.username Name for a custom user to create
  ## ref: https://github.com/bitnami/containers/tree/main/bitnami/mysql#creating-a-database-user-on-first-run
  ##
  username: "user1"
  ## @param auth.password Password for the new user. Ignored if existing secret is provided
  ##
  #password: "user1"

primary:
  persistence:
    enabled: true
    subPath: ""
    storageClass: "aws-ebs-storageclass"  # 存储类
    size: 16Gi  # 初始请求的大小
      # hostPath:
      # path: /database/mysql/data/
  service:
    type: NodePort
    ports:
      mysql: 3306
      mysqlx: 33060
    nodePorts:
      mysql: 31006
      mysqlx: 31060

rabbit-value.yaml

bash 复制代码
global:
  storageClass: "aws-ebs-storageclass"
image:
  registry: docker.io
  repository: bitnami/rabbitmq
  tag: 4.0.2-debian-12-r0
    #  pullPolicy: IfNotPresent
  pullPolicy: Always

# 账号密码
auth:
  username: rabbit
  password: "rabbit"
  securePassword: false
## @param plugins List of default plugins to enable (should only be altered to remove defaults; for additional plugins use `extraPlugins`)
##
#plugins: "rabbitmq_management rabbitmq_peer_discovery_k8s"

## @param communityPlugins List of Community plugins (URLs) to be downloaded during container initialization
## Combine it with extraPlugins to also enable them.
##
communityPlugins: "https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/v4.0.2/rabbitmq_delayed_message_exchange-4.0.2.ez"
## @param extraPlugins Extra plugins to enable (single string containing a space-separated list)
## Use this instead of `plugins` to add new plugins
##
extraPlugins: "rabbitmq_auth_backend_ldap rabbitmq_delayed_message_exchange"
# 集群实例数量
replicaCount: 1

# 资源配置
resources:
  requests: 
    cpu: 100m
    memory: 2Gi
  limits:
    cpu: 2000m
    memory: 2Gi

# 持久化存储
persistence:
  enabled: true
  storageClass: "aws-ebs-storageclass"
  size: 8Gi

# service 配置
service:
  type: NodePort

redis-value.yaml

bash 复制代码
global:
  storageClass: "aws-ebs-storageclass"
  redis:
    password: ""
 
architecture: standalone
 
commonConfiguration: |-
  appendonly yes
  save "300 10"
 
master:
  resources:
    limits: 
      cpu: 2
      memory: 4Gi
    requests: 
      cpu: 500m
      memory: 2Gi
  
  nodeSelector: {}
  tolerations: []
 
  persistence:
    size: 10Gi
 
  service:
    type: NodePort
    nodePorts:
      redis: "30502"
相关推荐
QQ_7781329749 分钟前
在K8S中使用Values文件定制不同环境下的应用配置详解
kubernetes
m0_7482455215 分钟前
冯诺依曼架构和哈佛架构的主要区别?
微服务·云原生·架构
huosenbulusi9 小时前
helm推送到harbor私有库--http: server gave HTTP response to HTTPS client
云原生·容器·k8s
不会飞的小龙人9 小时前
Docker Compose创建镜像服务
linux·运维·docker·容器·镜像
不会飞的小龙人9 小时前
Docker基础安装与使用
linux·运维·docker·容器
weixin_SAG10 小时前
第3天:阿里巴巴微服务解决方案概览
微服务·云原生·架构
helianying5512 小时前
云原生架构下的AI智能编排:ScriptEcho赋能前端开发
前端·人工智能·云原生·架构
元气满满的热码式14 小时前
K8S中Service详解(三)
云原生·容器·kubernetes
染诗15 小时前
docker部署flask项目后,请求时总是报拒绝连接错误
docker·容器·flask