kubernetes 配置yaml文件

ktca8awb  于 2023-10-17  发布在  Kubernetes
关注(0)|答案(1)|浏览(98)

我正在学习K8,我在MS文档中找到了一个例子。我的问题是,我想切换正在使用的GCLUB库。我还没能弄清楚这个yaml示例中的路径

apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: azure-vote-back
 spec:
    replicas: 1
    selector:
      matchLabels:
  app: azure-vote-back
  template:
    metadata:
      labels:
      app: azure-vote-back
  spec:
    nodeSelector:
    "kubernetes.io/os": linux
  containers:
  - name: azure-vote-back
    image: mcr.microsoft.com/oss/bitnami/redis:6.0.8
    env:
    - name: ALLOW_EMPTY_PASSWORD
      value: "yes"
    resources:
      requests:
        cpu: 100m
        memory: 128Mi
      limits:
        cpu: 250m
        memory: 256Mi
    ports:
    - containerPort: 6379
      name: redis
    ---
    apiVersion: v1
    kind: Service
    metadata:
     name: azure-vote-back
    spec:
      ports:
      - port: 6379
    selector:
    app: azure-vote-back
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
       name: azure-vote-front
         spec:
    replicas: 1
      selector:
       matchLabels:
     app: azure-vote-front
    template:
  metadata:
    labels:
      app: azure-vote-front
  spec:
     nodeSelector:
        "kubernetes.io/os": linux
  containers:
  - name: azure-vote-front
    image: mcr.microsoft.com/azuredocs/azure-vote-front:v1
    resources:
      requests:
        cpu: 100m
        memory: 128Mi
      limits:
        cpu: 250m
        memory: 256Mi
    ports:
    - containerPort: 80
    env:
    - name: REDIS
      value: "azure-vote-back"
    ---
    apiVersion: v1
    kind: Service
    metadata:
    name: azure-vote-front
 spec:
   type: LoadBalancer
   ports:
   - port: 80
   selector:
app: azure-vote-front
w8f9ii69

w8f9ii691#

这个YAML示例根本没有Github Repo字段。所以你找不到路。
如果您尝试更改容器映像源,则必须来自容器注册表(或您自己的文件系统),该注册表位于

containers: image: mcr.microsoft.com/azuredocs/azure-vote-front:v1

其中mcr.microsoft.com是容器注册表。
你不能直接将其连接到Github仓库,但任何容器注册表都可以工作,我相信Github在https://ghcr.io上有一个(该链接本身将引导你回到Github)

相关问题