在基于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"
相关推荐
昌sit!1 小时前
K8S node节点没有相应的pod镜像运行故障处理办法
云原生·容器·kubernetes
A ?Charis4 小时前
Gitlab-runner running on Kubernetes - hostAliases
容器·kubernetes·gitlab
wclass-zhengge4 小时前
Docker篇(Docker Compose)
运维·docker·容器
茶馆大橘4 小时前
微服务系列五:避免雪崩问题的限流、隔离、熔断措施
java·jmeter·spring cloud·微服务·云原生·架构·sentinel
北漂IT民工_程序员_ZG5 小时前
k8s集群安装(minikube)
云原生·容器·kubernetes
coding侠客5 小时前
揭秘!微服务架构下,Apollo 配置中心凭啥扮演关键角色?
微服务·云原生·架构
梦魇梦狸º8 小时前
腾讯轻量云服务器docker拉取不到镜像的问题:拉取超时
docker·容器·github
南猿北者10 小时前
docker镜像仓库常用命令
运维·docker·容器
2301_8061313611 小时前
Kubernetes的基本构建块和最小可调度单元pod-0
云原生·容器·kubernetes
SilentCodeY12 小时前
containerd配置私有仓库registry
容器·kubernetes·containerd·镜像·crictl