docker-registry
配置文件
- 具体yaml文件
#apiVersion: v1 #kind: Namespace #metadata: # name: docker-registry # apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: registry-sc provisioner: diskplugin.csi.alibabacloud.com parameters: type: cloud_ssd reclaimPolicy: Retain volumeBindingMode: WaitForFirstConsumer allowVolumeExpansion: true --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: registry-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 100Gi storageClassName: registry-sc --- apiVersion: apps/v1 kind: StatefulSet metadata: name: docker-registry #namespace: docker-registry spec: replicas: 1 selector: matchLabels: app: docker-registry serviceName: docker-registry template: metadata: labels: app: docker-registry spec: containers: - name: docker-registry #image: registry:2.6.2 image: registry env: - name: REGISTRY_HTTP_ADDR value: ":80" - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY value: "/var/lib/registry" ports: - name: http containerPort: 80 volumeMounts: - name: image-store mountPath: "/var/lib/registry" volumes: #- name: image-store # emptyDir: {} - name: image-store persistentVolumeClaim: claimName: registry-pvc --- kind: Service apiVersion: v1 metadata: name: docker-registry #namespace: docker-registry labels: app: docker-registry spec: selector: app: docker-registry ports: - name: http port: 80 targetPort: 80
-
创建registry(statefulSet)应用
kubectl apply -f docker-registry.yaml<root@K8S-CP ~># kubectl apply -f registry-deploy.yaml storageclass.storage.k8s.io/registry-sc unchanged persistentvolumeclaim/registry-pvc unchanged statefulset.apps/docker-registry created service/docker-registry created