当前位置: 首页 > article >正文

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

中间件下载使用helm,这里部署的都是单机版的
在这里插入图片描述
aws-ebs-storageclass.yaml

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

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

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

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

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"


http://www.kler.cn/a/374722.html

相关文章:

  • 图传推流学习(敬请期待)
  • 优化宝典:数据库性能提升指南
  • 【Python】动态与静态的较量:深入探讨Python的动态类型机制与类型提示的应用
  • Rust:文档注释 //! 和 ///
  • 执行Django项目的数据库迁移命令时报错:(1050, “Table ‘django_session‘ already exists“);如何破?
  • C++知识点复习
  • ZK范式系列之zkVM介绍(1)
  • 对镜像精简
  • 014:无人机遥控器操作
  • Jenkins You‘re using ‘Known hosts file‘,known_hosts file does not exist
  • 优化客户服务流程:提升效率与满意度的双赢策略
  • [java][基础]JSP
  • TensorFlow_T4 猴痘病识别
  • 超子物联网HAL库笔记:[汇总]
  • Linux中使用NGINX
  • 第9章 JDBC编程
  • Golang | Leetcode Golang题解之第517题超级洗衣机
  • #渗透测试#SRC漏洞挖掘# 信息收集-Shodan之搜索语法进阶
  • 5G基站开通与调测
  • 重塑重工起重行业未来:网关与云平台携手共创价值新篇章
  • 基于单片机的库房环境监测控制系统设计
  • 浅析国产晶体管输出光耦合器
  • 【隐私计算篇】全同态加密应用场景案例(隐私云计算中的大模型推理、生物识别等)
  • 【题解】【分治】——Secret Cow Code S
  • 深入探讨 HTTP 与 HTTPS
  • 高效 TCP 代理服务器的实战解析:Go 语言编写的高性能代理实例20241028