在基于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"
相关推荐
xiangshangdemayi27 分钟前
Windows环境GeoServer打包Docker极速入门
windows·docker·容器·geoserver·打包·数据挂载
程序员JerrySUN1 小时前
熟悉的 Docker,陌生的 Podman
linux·docker·容器·系统架构·podman
长囧鹿2 小时前
云原生之k8s服务管理
云原生·容器·kubernetes
gobeyye2 小时前
Docker 用法详解
运维·docker·容器
怡雪~2 小时前
centos7.9搭建k8s集群
云原生·容器·kubernetes
雪碧聊技术4 小时前
Docker3:docker基础1
运维·docker·容器·docker常见命令
我要用代码向我喜欢的女孩表白6 小时前
k8s入门(不教部署,部署跟着文档来就行了)
云原生·容器·kubernetes
FLGB7 小时前
Docker 安装单机版mysql 并持久化数据
mysql·docker·容器
晴子呀15 小时前
微服务系列概览
微服务·云原生·架构
小柒xq16 小时前
使用docker compose安装部署gitlab
docker·容器·gitlab