Digital Ocean Docker registry



doctl registry create szabgab-demo

The URL of the registy then going to be:


registry.digitalocean.com/szabgab-demo

In order to login to the Docker registry:


sudo snap connect doctl:dot-docker
doctl registry login

Locally build the docker image (as earlier) so we can try it:


docker build -t myflask:1.00 -f Dockerfile_echo_get .


docker tag myflask:1.00 registry.digitalocean.com/szabgab-demo/myflask:1.00

Then push to the registry


docker push registry.digitalocean.com/szabgab-demo/myflask:1.00

Web based integration between the Kubernetes cluster and the Docker registry. See this explanation: How to Use Your Private DigitalOcean Container Registry with Docker and Kubernetes


examples/k8s/deploy_echo_get.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echo-get-deployment
spec:
  selector:
    matchLabels:
      run: echo-get-pod
  replicas: 2
  template:
    metadata:
      labels:
        run: echo-get-pod
    spec:
      containers:
        - name: echo-get-container
          #image: python:3.9
          #command: ["tail", "-f", "/etc/passwd"]
          #myflask:1.00
          image: registry.digitalocean.com/szabgab-demo/myflask:1.00
          imagePullPolicy: Always
          #imagePullPolicy: Never
          ports:
            - containerPort: 5000

kubectl apply -f deploy_echo_get.yaml


kubectl exec -it echo-get-deployment-bb5bd946-p6k6m -- bash

add load balancers


examples/k8s/load_balancer.yml
apiVersion: v1
kind: Service
metadata:
  name: echo-get-loadbalancer
  annotations:
    service.beta.kubernetes.io/do-loadbalancer-protocol: "http"
    service.beta.kubernetes.io/do-loadbalancer-size-slug: "lb-small"
spec:
  type: LoadBalancer
  selector:
    run: echo-get-pod
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 5000

kubectl apply -f load_balancer.yaml