DEV Community

Anuchit Prasertsang
Anuchit Prasertsang

Posted on

1

สร้าง Kubernetes Secret manifest file สำหรับ Private Image Registry

ความเดิมตอนที่แล้ว

เราสามารถสร้าง

เราสามารถไฟล์ file secrete manifest เอาไว้ใช้งานได้ดังนี้

gitlab-registry-secret.yaml

apiVersion: v1
kind: Secret
metadata:
  name: regcred
  namespace: default  # Change this if you want to use a different namespace
type: kubernetes.io/dockerconfigjson
data:
  .dockerconfigjson: <base64-encoded-docker-config>
Enter fullscreen mode Exit fullscreen mode

<base64-encoded-docker-config> นำมาจากการ encode ไฟล์ config.json

โดยใช้คำสั่ง cat config.json | base64

ลักษณะของไฟล์ docker/config.json

{
  "auths": {
    "<REGISTRY_UR>": {
      "username": "<REGISTRY_USERNAME>",
      "password": "<REGISTRY_PASSWORD>",
      "email": "<REGISTRY_EMAIL>"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

ตัวอย่างเช่น

{
  "auths": {
    "https://registry.gitlab.com": {
      "username": "mygitlab",
      "password": "glpat-xk......E5",
      "email": "hello@gmail.com"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

จากนั้นทำการ
kubectl apply -f gitlab-registry-secret.yaml

ก็เป็นอันเรียบร้อย

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more