持续集成与持续交付 - 使用Helm在K8S安装Registry

使用Helm在K8S安装Registry



前言

作为容器与Kubernetes解决方案的开发者,我们经常需要将容器镜像推送到/拉取自一个私有Registry。尤其是在做原型或测试时,设置这样一个本地Registry,非常适合开发者个人或者一小组成员访问。
Kubernetes是一个理想的解决方案。本文将演示如何使用Helm安装一个本地Registry。


一、Docker Registry是什么?

Registry是一个存储和内容传递系统,包含有不同标记版本的Docker映像。

样例: the image distribution/registry, with tags 2.0 and 2.1

通过docker push或docker pull与Registry交互

样例: docker pull registry-1.docker.io/distribution/registry:2.1

二、步骤

1.查看K8S集群

命令如下:

controlplane $ kubectl version --short && \
> kubectl get componentstatus && \
> kubectl get nodes && \
> kubectl cluster-info
Client Version: v1.18.0
Server Version: v1.18.0
NAME                 STATUS    MESSAGE             ERROR
controller-manager   Healthy   ok                  
scheduler            Healthy   ok                  
etcd-0               Healthy   {"health":"true"}   
NAME           STATUS   ROLES    AGE   VERSION
controlplane   Ready    master   12m   v1.18.0
node01         Ready    <none>   12m   v1.18.0
Kubernetes master is running at https://172.17.0.8:6443
dash-kubernetes-dashboard is running at https://172.17.0.8:6443/api/v1/namespaces/kube-system/services/https:dash-kubernetes-dashboard:https/proxy
KubeDNS is running at https://172.17.0.8:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
controlplane $ helm version --short
v3.1.2+gd878d4d
controlplane $ 

获取Dashboard的token

controlplane $ token.sh
To access the dashboard click on the Kubernetes Dashboard tab above this command 
line. At the sign in prompt select Token and paste in the token that is shown below.

For Kubernetes clusters exposed to the public, always lock administration access including 
access to the dashboard. Why? https://www.wired.com/story/cryptojacking-tesla-amazon-cloud/

--- Copy and paste this token for dashboard access ---

eyJhbGciOiJSUzI1NiIsImtpZCI6InJKUUQwMTVtMm5JUjE1VVBNWXFBdndTQVpfeVRXWHUtb0JkOTRaNnMyd1UifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoLWt1YmVybmV0ZXMtZGFzaGJvYXJkLXRva2VuLTU0cDdsIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImRhc2gta3ViZXJuZXRlcy1kYXNoYm9hcmQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI0OTFmNDBmZC1lOTcxLTQwM2MtYWZiOS1kZjQ1YTRmMWJmNzgiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06ZGFzaC1rdWJlcm5ldGVzLWRhc2hib2FyZCJ9.i--GoSef5Hx_uSdCMILAJnYBrD_vknPjN7Z43IoD00116lP9pw78ytMM9Y3_N5GfnYpoyD4Cn1JKS9avJFWnMoDFuiIQenVZM3NDuKNVtZq7ZW8JgkssaC9gSX25ldYaHwvdSNLBw7iu07ji1K_42OU4KtkkgPNNzGwEEaVjTQ8wIz4zP-sFVRHv1SfFw3r_wlYlTJFr7s3ZxQoD8cpaWR6hheqrsz0DLdw5kfTil-BVjLeZDbbLya-PBRvmj6j-fQA1D_SYJihiDvTR5cqQMb7m1WwHi00K9yF4nG9ml-n-TSfcpw422sIRkk_03HXfhZlObYGThLWIh73WUA3IvA

2.安装Registry

我们使用helm来安装Registry。关于helm的更多知识,请移步到helm官网了解:

controlplane $ helm repo add twuni https://helm.twun.io #为Helm添加chart repository
"twuni" has been added to your repositories
controlplane $ #安装docker-registry应用
controlplane $ helm install registry twuni/docker-registry \
>   --version 1.10.0 \
>   --namespace kube-system \
>   --set service.type=NodePort \
>   --set service.nodePort=31500
NAME: registry
LAST DEPLOYED: Tue May  4 23:53:26 2021
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export NODE_PORT=$(kubectl get --namespace kube-system -o jsonpath="{.spec.ports[0].nodePort}" services registry-docker-registry)
  export NODE_IP=$(kubectl get nodes --namespace kube-system -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT
controlplane $ #查看kube-system命名空间下的service
controlplane $ kubectl get service --namespace kube-system
NAME                        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
dash-kubernetes-dashboard   NodePort    10.109.168.165   <none>        80:30000/TCP             112s
kube-dns                    ClusterIP   10.96.0.10       <none>        53/UDP,53/TCP,9153/TCP   117s
registry-docker-registry    NodePort    10.102.51.100    <none>        5000:31500/TCP           3s
controlplane $ export REGISTRY=2886795272-31500-simba10.environments.katacoda.com
controlplane $ kubectl get deployments registry-docker-registry --namespace kube-system
NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
registry-docker-registry   1/1     1            0           13s
controlplane $ #通过api查看仓库
controlplane $ curl $REGISTRY/v2/_catalog | jq -c
{"repositories":[]}
controlplane $ 

可以查看到仓库为空。

3.push至Registry

从dockerhub pull一个镜像,push到刚建立的Registry上。

controlplane $ docker pull replicated/dockerfilelint
Using default tag: latest
latest: Pulling from replicated/dockerfilelint
cbdbe7a5bc2a: Pull complete 
091983d60f65: Pull complete 
7bacc183740f: Pull complete 
c4a5a5d270d4: Pull complete 
867acec62da8: Pull complete 
513c9ceff6ba: Pull complete 
a678c69209e5: Pull complete 
4d70c498007f: Pull complete 
47b1b7b82f1b: Pull complete 
Digest: sha256:15ce784e5847966b6d9a88cba348a9429f8b5212f6017180f10ce36b472dfe52
Status: Downloaded newer image for replicated/dockerfilelint:latest
docker.io/replicated/dockerfilelint:latest
controlplane $ docker images | grep lint
replicated/dockerfilelint                             latest              24b7b3aae3ac        7 months ago        238MB
controlplane $ docker tag replicated/dockerfilelint $REGISTRY/dockerfilelint
controlplane $ docker push $REGISTRY/dockerfilelint
The push refers to repository [2886795272-31500-simba10.environments.katacoda.com/dockerfilelint]
4db43bad3862: Pushed 
351191f62788: Pushed 
e719c15dabdc: Pushed 
530aa387ee5c: Pushed 
1f793ff0a8fb: Pushed 
aedafbecb0b3: Pushed 
db809908a198: Pushed 
1b235e8e7bda: Pushed 
3e207b409db3: Pushed 
latest: digest: sha256:15ce784e5847966b6d9a88cba348a9429f8b5212f6017180f10ce36b472dfe52 size: 2206
controlplane $ curl $REGISTRY/v2/_catalog | jq
{
  "repositories": [
    "dockerfilelint"
  ]
}
controlplane $ 

4.Registry Web页面

上一步我们使用REST查看仓库信息,然而使用网页能更好地展示。这里我们安装joxit/docker-registry-ui来提供干净的网页接口。

controlplane $ cat registry-ui.yaml 
apiVersion: apps/v1
kind: Deployment
metadata:
  name: registry-ui-deployment
  labels:
    app: registry-ui
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: registry-ui
  template:
    metadata:
      labels:
        app: registry-ui
    spec:
      containers:
      - name: reg-ui
        image: joxit/docker-registry-ui:1.5-static
        env:
        - name: REGISTRY_URL
          value: "http://registry-docker-registry:5000"
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: registry-ui
  labels:
    app: registry-ui
  namespace: kube-system
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    nodePort: 31000
    protocol: TCP
  selector:
    app: registry-ui
    
controlplane $ kubectl apply -f registry-ui.yaml
deployment.apps/registry-ui-deployment created
service/registry-ui created
controlplane $ 

访问web页面
在这里插入图片描述

5.build镜像并push

我们从IBM获得一个聪明的应用程序,该应用程序使用Tensorflow来检测乳腺癌肿瘤细胞图像中是否存在有丝分裂。
这个仓库中,待检测的PNG图片大小为64x64。

controlplane $ git clone https://github.com/IBM/MAX-Breast-Cancer-Mitosis-Detector.git && cd MAX-Breast-Cancer-Mitosis-Detector
Cloning into 'MAX-Breast-Cancer-Mitosis-Detector'...
remote: Enumerating objects: 214, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 214 (delta 15), reused 12 (delta 4), pack-reused 177
Receiving objects: 100% (214/214), 705.23 KiB | 2.16 MiB/s, done.
Resolving deltas: 100% (90/90), done.
controlplane $ docker build -t $REGISTRY/max-breast-cancer-mitosis-detector .
Sending build context to Docker daemon  230.4kB
Step 1/12 : FROM quay.io/codait/max-base:v1.4.0
v1.4.0: Pulling from codait/max-base
b8f262c62ec6: Pull complete 
0a43c0154f16: Pull complete 
906d7b5da8fb: Pull complete 
079aad1b3615: Pull complete 
1eed0602da40: Pull complete 
9bba78d911e2: Pull complete 
491429e01696: Pull complete 
979d37cd2030: Pull complete 
5612cd136ee1: Pull complete 
Digest: sha256:1f09c52c5461b4a13b3a2e6166acac5165596a6e3f65b5c168a880cd4ac6bebe
Status: Downloaded newer image for quay.io/codait/max-base:v1.4.0
 ---> 769b57b767e7
Step 2/12 : ARG model_bucket=https://max-cdn.cdn.appdomain.cloud/max-breast-cancer-mitosis-detector/1.0.1
 ---> Running in b63a6e917de8
Removing intermediate container b63a6e917de8
 ---> dcd4cfdd2f14
Step 3/12 : ARG model_file=assets.tar.gz
 ---> Running in 62b434a90f28
Removing intermediate container 62b434a90f28
 ---> 09c9fb3c1fe4
Step 4/12 : RUN sudo apt-get update && sudo apt-get install -y libopenslide0 gcc && sudo rm -rf /var/lib/apt/lists/*
 ---> Running in f4c5f38a6488
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [285 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [10.9 kB]
Fetched 8441 kB in 2s (5624 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-8
  fontconfig-config fonts-dejavu-core gcc-8 libasan5 libatomic1 libbinutils
  libc-dev-bin libc6-dev libcairo2 libcc1-0 libfontconfig1 libfreetype6
  libgcc-8-dev libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common
  libgomp1 libisl19 libitm1 libjbig0 libjpeg62-turbo liblsan0 libmpc3 libmpfr6
  libmpx2 libopenjp2-7 libpixman-1-0 libpng16-16 libquadmath0 libtiff5
  libtsan0 libubsan1 libwebp6 libxcb-render0 libxcb-shm0 linux-libc-dev
  manpages manpages-dev
Suggested packages:
  binutils-doc cpp-doc gcc-8-locales gcc-multilib make autoconf automake
  libtool flex bison gdb gcc-doc gcc-8-multilib gcc-8-doc libgcc1-dbg
  libgomp1-dbg libitm1-dbg libatomic1-dbg libasan5-dbg liblsan0-dbg
  libtsan0-dbg libubsan1-dbg libmpx2-dbg libquadmath0-dbg glibc-doc
  man-browser
The following NEW packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-8
  fontconfig-config fonts-dejavu-core gcc gcc-8 libasan5 libatomic1
  libbinutils libc-dev-bin libc6-dev libcairo2 libcc1-0 libfontconfig1
  libfreetype6 libgcc-8-dev libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin
  libgdk-pixbuf2.0-common libgomp1 libisl19 libitm1 libjbig0 libjpeg62-turbo
  liblsan0 libmpc3 libmpfr6 libmpx2 libopenjp2-7 libopenslide0 libpixman-1-0
  libpng16-16 libquadmath0 libtiff5 libtsan0 libubsan1 libwebp6 libxcb-render0
  libxcb-shm0 linux-libc-dev manpages manpages-dev
0 upgraded, 45 newly installed, 0 to remove and 23 not upgraded.
Need to get 40.9 MB of archives.
After this operation, 149 MB of additional disk space will be used.
Get:1 http://security.debian.org/debian-security buster/updates/main amd64 libopenjp2-7 amd64 2.3.0-2+deb10u2 [158 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 manpages all 4.16-2 [1295 kB]
Get:3 http://deb.debian.org/debian buster/main amd64 binutils-common amd64 2.31.1-16 [2073 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 libbinutils amd64 2.31.1-16 [478 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 binutils-x86-64-linux-gnu amd64 2.31.1-16 [1823 kB]
Get:6 http://deb.debian.org/debian buster/main amd64 binutils amd64 2.31.1-16 [56.8 kB]
Get:7 http://deb.debian.org/debian buster/main amd64 libisl19 amd64 0.20-2 [587 kB]
Get:8 http://deb.debian.org/debian buster/main amd64 libmpfr6 amd64 4.0.2-1 [775 kB]
Get:9 http://deb.debian.org/debian buster/main amd64 libmpc3 amd64 1.1.0-1 [41.3 kB]
Get:10 http://deb.debian.org/debian buster/main amd64 cpp-8 amd64 8.3.0-6 [8914 kB]
Get:11 http://deb.debian.org/debian buster/main amd64 cpp amd64 4:8.3.0-1 [19.4 kB]
Get:12 http://deb.debian.org/debian buster/main amd64 fonts-dejavu-core all 2.37-1 [1068 kB]
Get:13 http://deb.debian.org/debian buster/main amd64 fontconfig-config all 2.13.1-2 [280 kB]
Get:14 http://deb.debian.org/debian buster/main amd64 libcc1-0 amd64 8.3.0-6 [46.6 kB]
Get:15 http://deb.debian.org/debian buster/main amd64 libgomp1 amd64 8.3.0-6 [75.8 kB]
Get:16 http://deb.debian.org/debian buster/main amd64 libitm1 amd64 8.3.0-6 [27.7 kB]
Get:17 http://deb.debian.org/debian buster/main amd64 libatomic1 amd64 8.3.0-6 [9032 B]
Get:18 http://deb.debian.org/debian buster/main amd64 libasan5 amd64 8.3.0-6 [362 kB]
Get:19 http://deb.debian.org/debian buster/main amd64 liblsan0 amd64 8.3.0-6 [131 kB]
Get:20 http://deb.debian.org/debian buster/main amd64 libtsan0 amd64 8.3.0-6 [283 kB]
Get:21 http://deb.debian.org/debian buster/main amd64 libubsan1 amd64 8.3.0-6 [120 kB]
Get:22 http://deb.debian.org/debian buster/main amd64 libmpx2 amd64 8.3.0-6 [11.4 kB]
Get:23 http://deb.debian.org/debian buster/main amd64 libquadmath0 amd64 8.3.0-6 [133 kB]
Get:24 http://deb.debian.org/debian buster/main amd64 libgcc-8-dev amd64 8.3.0-6 [2298 kB]
Get:25 http://deb.debian.org/debian buster/main amd64 gcc-8 amd64 8.3.0-6 [9452 kB]
Get:26 http://deb.debian.org/debian buster/main amd64 gcc amd64 4:8.3.0-1 [5196 B]
Get:27 http://deb.debian.org/debian buster/main amd64 libc-dev-bin amd64 2.28-10 [275 kB]
Get:28 http://deb.debian.org/debian buster/main amd64 linux-libc-dev amd64 4.19.181-1 [1441 kB]
Get:29 http://deb.debian.org/debian buster/main amd64 libc6-dev amd64 2.28-10 [2691 kB]
Get:30 http://deb.debian.org/debian buster/main amd64 libpng16-16 amd64 1.6.36-6 [292 kB]
Get:31 http://deb.debian.org/debian buster/main amd64 libfreetype6 amd64 2.9.1-3+deb10u2 [380 kB]
Get:32 http://deb.debian.org/debian buster/main amd64 libfontconfig1 amd64 2.13.1-2 [346 kB]
Get:33 http://deb.debian.org/debian buster/main amd64 libpixman-1-0 amd64 0.36.0-1 [537 kB]
Get:34 http://deb.debian.org/debian buster/main amd64 libxcb-render0 amd64 1.13.1-2 [109 kB]
Get:35 http://deb.debian.org/debian buster/main amd64 libxcb-shm0 amd64 1.13.1-2 [99.2 kB]
Get:36 http://deb.debian.org/debian buster/main amd64 libcairo2 amd64 1.16.0-4+deb10u1 [688 kB]
Get:37 http://deb.debian.org/debian buster/main amd64 libjpeg62-turbo amd64 1:1.5.2-2+deb10u1 [133 kB]
Get:38 http://deb.debian.org/debian buster/main amd64 libjbig0 amd64 2.1-3.1+b2 [31.0 kB]
Get:39 http://deb.debian.org/debian buster/main amd64 libwebp6 amd64 0.6.1-2 [263 kB]
Get:40 http://deb.debian.org/debian buster/main amd64 libtiff5 amd64 4.1.0+git191117-2~deb10u2 [271 kB]
Get:41 http://deb.debian.org/debian buster/main amd64 libgdk-pixbuf2.0-common all 2.38.1+dfsg-1 [316 kB]
Get:42 http://deb.debian.org/debian buster/main amd64 libgdk-pixbuf2.0-0 amd64 2.38.1+dfsg-1 [177 kB]
Get:43 http://deb.debian.org/debian buster/main amd64 libgdk-pixbuf2.0-bin amd64 2.38.1+dfsg-1 [24.1 kB]
Get:44 http://deb.debian.org/debian buster/main amd64 libopenslide0 amd64 3.4.1+dfsg-4 [85.8 kB]
Get:45 http://deb.debian.org/debian buster/main amd64 manpages-dev all 4.16-2 [2232 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 40.9 MB in 1s (57.8 MB/s)
Selecting previously unselected package manpages.
(Reading database ... 12692 files and directories currently installed.)
Preparing to unpack .../00-manpages_4.16-2_all.deb ...
Unpacking manpages (4.16-2) ...
Selecting previously unselected package binutils-common:amd64.
Preparing to unpack .../01-binutils-common_2.31.1-16_amd64.deb ...
Unpacking binutils-common:amd64 (2.31.1-16) ...
Selecting previously unselected package libbinutils:amd64.
Preparing to unpack .../02-libbinutils_2.31.1-16_amd64.deb ...
Unpacking libbinutils:amd64 (2.31.1-16) ...
Selecting previously unselected package binutils-x86-64-linux-gnu.
Preparing to unpack .../03-binutils-x86-64-linux-gnu_2.31.1-16_amd64.deb ...
Unpacking binutils-x86-64-linux-gnu (2.31.1-16) ...
Selecting previously unselected package binutils.
Preparing to unpack .../04-binutils_2.31.1-16_amd64.deb ...
Unpacking binutils (2.31.1-16) ...
Selecting previously unselected package libisl19:amd64.
Preparing to unpack .../05-libisl19_0.20-2_amd64.deb ...
Unpacking libisl19:amd64 (0.20-2) ...
Selecting previously unselected package libmpfr6:amd64.
Preparing to unpack .../06-libmpfr6_4.0.2-1_amd64.deb ...
Unpacking libmpfr6:amd64 (4.0.2-1) ...
Selecting previously unselected package libmpc3:amd64.
Preparing to unpack .../07-libmpc3_1.1.0-1_amd64.deb ...
Unpacking libmpc3:amd64 (1.1.0-1) ...
Selecting previously unselected package cpp-8.
Preparing to unpack .../08-cpp-8_8.3.0-6_amd64.deb ...
Unpacking cpp-8 (8.3.0-6) ...
Selecting previously unselected package cpp.
Preparing to unpack .../09-cpp_4%3a8.3.0-1_amd64.deb ...
Unpacking cpp (4:8.3.0-1) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../10-fonts-dejavu-core_2.37-1_all.deb ...
Unpacking fonts-dejavu-core (2.37-1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../11-fontconfig-config_2.13.1-2_all.deb ...
Unpacking fontconfig-config (2.13.1-2) ...
Selecting previously unselected package libcc1-0:amd64.
Preparing to unpack .../12-libcc1-0_8.3.0-6_amd64.deb ...
Unpacking libcc1-0:amd64 (8.3.0-6) ...
Selecting previously unselected package libgomp1:amd64.
Preparing to unpack .../13-libgomp1_8.3.0-6_amd64.deb ...
Unpacking libgomp1:amd64 (8.3.0-6) ...
Selecting previously unselected package libitm1:amd64.
Preparing to unpack .../14-libitm1_8.3.0-6_amd64.deb ...
Unpacking libitm1:amd64 (8.3.0-6) ...
Selecting previously unselected package libatomic1:amd64.
Preparing to unpack .../15-libatomic1_8.3.0-6_amd64.deb ...
Unpacking libatomic1:amd64 (8.3.0-6) ...
Selecting previously unselected package libasan5:amd64.
Preparing to unpack .../16-libasan5_8.3.0-6_amd64.deb ...
Unpacking libasan5:amd64 (8.3.0-6) ...
Selecting previously unselected package liblsan0:amd64.
Preparing to unpack .../17-liblsan0_8.3.0-6_amd64.deb ...
Unpacking liblsan0:amd64 (8.3.0-6) ...
Selecting previously unselected package libtsan0:amd64.
Preparing to unpack .../18-libtsan0_8.3.0-6_amd64.deb ...
Unpacking libtsan0:amd64 (8.3.0-6) ...
Selecting previously unselected package libubsan1:amd64.
Preparing to unpack .../19-libubsan1_8.3.0-6_amd64.deb ...
Unpacking libubsan1:amd64 (8.3.0-6) ...
Selecting previously unselected package libmpx2:amd64.
Preparing to unpack .../20-libmpx2_8.3.0-6_amd64.deb ...
Unpacking libmpx2:amd64 (8.3.0-6) ...
Selecting previously unselected package libquadmath0:amd64.
Preparing to unpack .../21-libquadmath0_8.3.0-6_amd64.deb ...
Unpacking libquadmath0:amd64 (8.3.0-6) ...
Selecting previously unselected package libgcc-8-dev:amd64.
Preparing to unpack .../22-libgcc-8-dev_8.3.0-6_amd64.deb ...
Unpacking libgcc-8-dev:amd64 (8.3.0-6) ...
Selecting previously unselected package gcc-8.
Preparing to unpack .../23-gcc-8_8.3.0-6_amd64.deb ...
Unpacking gcc-8 (8.3.0-6) ...
Selecting previously unselected package gcc.
Preparing to unpack .../24-gcc_4%3a8.3.0-1_amd64.deb ...
Unpacking gcc (4:8.3.0-1) ...
Selecting previously unselected package libc-dev-bin.
Preparing to unpack .../25-libc-dev-bin_2.28-10_amd64.deb ...
Unpacking libc-dev-bin (2.28-10) ...
Selecting previously unselected package linux-libc-dev:amd64.
Preparing to unpack .../26-linux-libc-dev_4.19.181-1_amd64.deb ...
Unpacking linux-libc-dev:amd64 (4.19.181-1) ...
Selecting previously unselected package libc6-dev:amd64.
Preparing to unpack .../27-libc6-dev_2.28-10_amd64.deb ...
Unpacking libc6-dev:amd64 (2.28-10) ...
Selecting previously unselected package libpng16-16:amd64.
Preparing to unpack .../28-libpng16-16_1.6.36-6_amd64.deb ...
Unpacking libpng16-16:amd64 (1.6.36-6) ...
Selecting previously unselected package libfreetype6:amd64.
Preparing to unpack .../29-libfreetype6_2.9.1-3+deb10u2_amd64.deb ...
Unpacking libfreetype6:amd64 (2.9.1-3+deb10u2) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../30-libfontconfig1_2.13.1-2_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.13.1-2) ...
Selecting previously unselected package libpixman-1-0:amd64.
Preparing to unpack .../31-libpixman-1-0_0.36.0-1_amd64.deb ...
Unpacking libpixman-1-0:amd64 (0.36.0-1) ...
Selecting previously unselected package libxcb-render0:amd64.
Preparing to unpack .../32-libxcb-render0_1.13.1-2_amd64.deb ...
Unpacking libxcb-render0:amd64 (1.13.1-2) ...
Selecting previously unselected package libxcb-shm0:amd64.
Preparing to unpack .../33-libxcb-shm0_1.13.1-2_amd64.deb ...
Unpacking libxcb-shm0:amd64 (1.13.1-2) ...
Selecting previously unselected package libcairo2:amd64.
Preparing to unpack .../34-libcairo2_1.16.0-4+deb10u1_amd64.deb ...
Unpacking libcairo2:amd64 (1.16.0-4+deb10u1) ...
Selecting previously unselected package libjpeg62-turbo:amd64.
Preparing to unpack .../35-libjpeg62-turbo_1%3a1.5.2-2+deb10u1_amd64.deb ...
Unpacking libjpeg62-turbo:amd64 (1:1.5.2-2+deb10u1) ...
Selecting previously unselected package libjbig0:amd64.
Preparing to unpack .../36-libjbig0_2.1-3.1+b2_amd64.deb ...
Unpacking libjbig0:amd64 (2.1-3.1+b2) ...
Selecting previously unselected package libwebp6:amd64.
Preparing to unpack .../37-libwebp6_0.6.1-2_amd64.deb ...
Unpacking libwebp6:amd64 (0.6.1-2) ...
Selecting previously unselected package libtiff5:amd64.
Preparing to unpack .../38-libtiff5_4.1.0+git191117-2~deb10u2_amd64.deb ...
Unpacking libtiff5:amd64 (4.1.0+git191117-2~deb10u2) ...
Selecting previously unselected package libgdk-pixbuf2.0-common.
Preparing to unpack .../39-libgdk-pixbuf2.0-common_2.38.1+dfsg-1_all.deb ...
Unpacking libgdk-pixbuf2.0-common (2.38.1+dfsg-1) ...
Selecting previously unselected package libgdk-pixbuf2.0-0:amd64.
Preparing to unpack .../40-libgdk-pixbuf2.0-0_2.38.1+dfsg-1_amd64.deb ...
Unpacking libgdk-pixbuf2.0-0:amd64 (2.38.1+dfsg-1) ...
Selecting previously unselected package libgdk-pixbuf2.0-bin.
Preparing to unpack .../41-libgdk-pixbuf2.0-bin_2.38.1+dfsg-1_amd64.deb ...
Unpacking libgdk-pixbuf2.0-bin (2.38.1+dfsg-1) ...
Selecting previously unselected package libopenjp2-7:amd64.
Preparing to unpack .../42-libopenjp2-7_2.3.0-2+deb10u2_amd64.deb ...
Unpacking libopenjp2-7:amd64 (2.3.0-2+deb10u2) ...
Selecting previously unselected package libopenslide0.
Preparing to unpack .../43-libopenslide0_3.4.1+dfsg-4_amd64.deb ...
Unpacking libopenslide0 (3.4.1+dfsg-4) ...
Selecting previously unselected package manpages-dev.
Preparing to unpack .../44-manpages-dev_4.16-2_all.deb ...
Unpacking manpages-dev (4.16-2) ...
Setting up libpixman-1-0:amd64 (0.36.0-1) ...
Setting up libxcb-render0:amd64 (1.13.1-2) ...
Setting up manpages (4.16-2) ...
Setting up libgdk-pixbuf2.0-common (2.38.1+dfsg-1) ...
Setting up binutils-common:amd64 (2.31.1-16) ...
Setting up linux-libc-dev:amd64 (4.19.181-1) ...
Setting up libxcb-shm0:amd64 (1.13.1-2) ...
Setting up libgomp1:amd64 (8.3.0-6) ...
Setting up libjbig0:amd64 (2.1-3.1+b2) ...
Setting up libasan5:amd64 (8.3.0-6) ...
Setting up libjpeg62-turbo:amd64 (1:1.5.2-2+deb10u1) ...
Setting up libmpfr6:amd64 (4.0.2-1) ...
Setting up libquadmath0:amd64 (8.3.0-6) ...
Setting up libpng16-16:amd64 (1.6.36-6) ...
Setting up libmpc3:amd64 (1.1.0-1) ...
Setting up libatomic1:amd64 (8.3.0-6) ...
Setting up libwebp6:amd64 (0.6.1-2) ...
Setting up fonts-dejavu-core (2.37-1) ...
Setting up libmpx2:amd64 (8.3.0-6) ...
Setting up libubsan1:amd64 (8.3.0-6) ...
Setting up libisl19:amd64 (0.20-2) ...
Setting up libopenjp2-7:amd64 (2.3.0-2+deb10u2) ...
Setting up libtiff5:amd64 (4.1.0+git191117-2~deb10u2) ...
Setting up libbinutils:amd64 (2.31.1-16) ...
Setting up cpp-8 (8.3.0-6) ...
Setting up libc-dev-bin (2.28-10) ...
Setting up libcc1-0:amd64 (8.3.0-6) ...
Setting up liblsan0:amd64 (8.3.0-6) ...
Setting up libitm1:amd64 (8.3.0-6) ...
Setting up binutils-x86-64-linux-gnu (2.31.1-16) ...
Setting up libtsan0:amd64 (8.3.0-6) ...
Setting up manpages-dev (4.16-2) ...
Setting up fontconfig-config (2.13.1-2) ...
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
Setting up binutils (2.31.1-16) ...
Setting up libfreetype6:amd64 (2.9.1-3+deb10u2) ...
Setting up libgdk-pixbuf2.0-0:amd64 (2.38.1+dfsg-1) ...
Setting up libgcc-8-dev:amd64 (8.3.0-6) ...
Setting up libgdk-pixbuf2.0-bin (2.38.1+dfsg-1) ...
Setting up cpp (4:8.3.0-1) ...
Setting up libc6-dev:amd64 (2.28-10) ...
Setting up libfontconfig1:amd64 (2.13.1-2) ...
Setting up gcc-8 (8.3.0-6) ...
Setting up libcairo2:amd64 (1.16.0-4+deb10u1) ...
Setting up gcc (4:8.3.0-1) ...
Setting up libopenslide0 (3.4.1+dfsg-4) ...
Processing triggers for libc-bin (2.28-10) ...
Removing intermediate container f4c5f38a6488
 ---> ed2771c7f2b8
Step 5/12 : RUN wget -nv --show-progress --progress=bar:force:noscroll ${model_bucket}/${model_file} --output-document=assets/${model_file} &&   tar -x -C assets/ -f assets/${model_file} -v && rm assets/${model_file}
 ---> Running in b90e1ce99baa
assets/assets.tar.g   0%[                    ]       0  --.-KB/s   assets/assets.tar.g 100%[===================>] 439.07K  --.-KB/s    in 0.02s   
2021-05-05 00:49:14 URL:https://max-cdn.cdn.appdomain.cloud/max-breast-cancer-mitosis-detector/1.0.1/assets.tar.gz [449605/449605] -> "assets/assets.tar.gz" [1]
./._deep_histopath_model.hdf5
deep_histopath_model.hdf5
Removing intermediate container b90e1ce99baa
 ---> 08494c5659a0
Step 6/12 : COPY requirements.txt .
 ---> 7494fe1b53df
Step 7/12 : RUN pip install -r requirements.txt
 ---> Running in 6071bcacd8ee
Collecting h5py==2.9.0
  Downloading h5py-2.9.0-cp37-cp37m-manylinux1_x86_64.whl (2.8 MB)
Requirement already satisfied: six in /opt/conda/lib/python3.7/site-packages (from h5py==2.9.0->-r requirements.txt (line 4)) (1.12.0)
Collecting numpy==1.17.5
  Downloading numpy-1.17.5-cp37-cp37m-manylinux1_x86_64.whl (20.0 MB)
Collecting openslide-python==1.1.1
  Downloading openslide-python-1.1.1.tar.gz (312 kB)
Collecting Pillow==8.1.1
  Downloading Pillow-8.1.1-cp37-cp37m-manylinux1_x86_64.whl (2.2 MB)
Collecting tensorflow==1.15.4
  Downloading tensorflow-1.15.4-cp37-cp37m-manylinux2010_x86_64.whl (110.5 MB)
Requirement already satisfied: wheel>=0.26 in /opt/conda/lib/python3.7/site-packages (from tensorflow==1.15.4->-r requirements.txt (line 2)) (0.33.6)
Collecting gast==0.2.2
  Downloading gast-0.2.2.tar.gz (10 kB)
Collecting tensorflow-estimator==1.15.1
  Downloading tensorflow_estimator-1.15.1-py2.py3-none-any.whl (503 kB)
Collecting absl-py>=0.7.0
  Downloading absl_py-0.12.0-py3-none-any.whl (129 kB)
Collecting astor>=0.6.0
  Downloading astor-0.8.1-py2.py3-none-any.whl (27 kB)
Collecting google-pasta>=0.1.6
  Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB)
Collecting grpcio>=1.8.6
  Downloading grpcio-1.37.1-cp37-cp37m-manylinux2014_x86_64.whl (4.2 MB)
Collecting keras-applications>=1.0.8
  Downloading Keras_Applications-1.0.8-py3-none-any.whl (50 kB)
Collecting keras-preprocessing>=1.0.5
  Downloading Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
Collecting opt-einsum>=2.3.2
  Downloading opt_einsum-3.3.0-py3-none-any.whl (65 kB)
Collecting protobuf>=3.6.1
  Downloading protobuf-3.15.8-cp37-cp37m-manylinux1_x86_64.whl (1.0 MB)
Collecting tensorboard<1.16.0,>=1.15.0
  Downloading tensorboard-1.15.0-py3-none-any.whl (3.8 MB)
Requirement already satisfied: werkzeug>=0.11.15 in /opt/conda/lib/python3.7/site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15.4->-r requirements.txt (line 2)) (0.16.1)
Requirement already satisfied: setuptools>=41.0.0 in /opt/conda/lib/python3.7/site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15.4->-r requirements.txt (line 2)) (41.4.0)
Collecting markdown>=2.6.8
  Downloading Markdown-3.3.4-py3-none-any.whl (97 kB)
Requirement already satisfied: importlib-metadata in /opt/conda/lib/python3.7/site-packages (from markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15.4->-r requirements.txt (line 2)) (3.3.0)
Collecting termcolor>=1.1.0
  Downloading termcolor-1.1.0.tar.gz (3.9 kB)
Collecting wrapt>=1.11.1
  Downloading wrapt-1.12.1.tar.gz (27 kB)
Requirement already satisfied: typing-extensions>=3.6.4 in /opt/conda/lib/python3.7/site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15.4->-r requirements.txt (line 2)) (3.7.4.3)
Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.7/site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15.4->-r requirements.txt (line 2)) (3.4.0)
Building wheels for collected packages: openslide-python, gast, termcolor, wrapt
  Building wheel for openslide-python (setup.py): started
  Building wheel for openslide-python (setup.py): finished with status 'done'
  Created wheel for openslide-python: filename=openslide_python-1.1.1-cp37-cp37m-linux_x86_64.whl size=28775 sha256=ea7698cffe81bee72f82b4805405f70bca92c3c3f50bfa1a1fc5d421f2fbf524
  Stored in directory: /home/max/.cache/pip/wheels/58/b3/05/e26ea0e774fe2232c62d3e80f79c6061d23c3dc72b240cd03f
  Building wheel for gast (setup.py): started
  Building wheel for gast (setup.py): finished with status 'done'
  Created wheel for gast: filename=gast-0.2.2-py3-none-any.whl size=7539 sha256=cabd55e2ce2965b78bbf6b820b4b8064818b1b0f9e4e7b451081ecd69b0030f6
  Stored in directory: /home/max/.cache/pip/wheels/21/7f/02/420f32a803f7d0967b48dd823da3f558c5166991bfd204eef3
  Building wheel for termcolor (setup.py): started
  Building wheel for termcolor (setup.py): finished with status 'done'
  Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4830 sha256=afc0a696467fecb3db0e72f43146a09ef1b0a907c27fb31011425e12de8e4c31
  Stored in directory: /home/max/.cache/pip/wheels/3f/e3/ec/8a8336ff196023622fbcb36de0c5a5c218cbb24111d1d4c7f2
  Building wheel for wrapt (setup.py): started
  Building wheel for wrapt (setup.py): finished with status 'done'
  Created wheel for wrapt: filename=wrapt-1.12.1-cp37-cp37m-linux_x86_64.whl size=76444 sha256=b3f25744d6d8526d402f324f9332c4078560c99957d01d811da8845587e8253b
  Stored in directory: /home/max/.cache/pip/wheels/62/76/4c/aa25851149f3f6d9785f6c869387ad82b3fd37582fa8147ac6
Successfully built openslide-python gast termcolor wrapt
Installing collected packages: numpy, protobuf, markdown, h5py, grpcio, absl-py, wrapt, termcolor, tensorflow-estimator, tensorboard, Pillow, opt-einsum, keras-preprocessing, keras-applications, google-pasta, gast, astor, tensorflow, openslide-python
Successfully installed Pillow-8.1.1 absl-py-0.12.0 astor-0.8.1 gast-0.2.2 google-pasta-0.2.0 grpcio-1.37.1 h5py-2.9.0 keras-applications-1.0.8 keras-preprocessing-1.1.2 markdown-3.3.4 numpy-1.17.5 openslide-python-1.1.1 opt-einsum-3.3.0 protobuf-3.15.8 tensorboard-1.15.0 tensorflow-1.15.4 tensorflow-estimator-1.15.1 termcolor-1.1.0 wrapt-1.12.1
WARNING: You are using pip version 20.3.3; however, version 21.1.1 is available.
You should consider upgrading via the '/opt/conda/bin/python -m pip install --upgrade pip' command.
Removing intermediate container 6071bcacd8ee
 ---> 374d03f8f0c7
Step 8/12 : RUN git clone https://github.com/codait/deep-histopath &&     cd deep-histopath &&     git checkout c8baf8d47b6c08c0f6c7b1fb6d5dd6b77e711c33 &&     cd - &&     mv -n deep-histopath/* .
 ---> Running in 9c06e62e3610
Cloning into 'deep-histopath'...
Note: checking out 'c8baf8d47b6c08c0f6c7b1fb6d5dd6b77e711c33'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at c8baf8d V2 for Mitosis Detection (#43)
/home/max
Removing intermediate container 9c06e62e3610
 ---> bdde96749982
Step 9/12 : COPY . .
 ---> 99882701e8b8
Step 10/12 : RUN sha512sum -c sha512sums.txt
 ---> Running in ffdedeaa2223
assets/deep_histopath_model.hdf5: OK
Removing intermediate container ffdedeaa2223
 ---> 0d2d2384d7de
Step 11/12 : EXPOSE 5000
 ---> Running in c4f20b68dd9d
Removing intermediate container c4f20b68dd9d
 ---> bc38eef9c933
Step 12/12 : CMD python app.py
 ---> Running in 02450fc06c5c
Removing intermediate container 02450fc06c5c
 ---> d433d06b452f
Successfully built d433d06b452f
Successfully tagged 2886795276-31500-simba10.environments.katacoda.com/max-breast-cancer-mitosis-detector:latest
controlplane $ 

push到Registry

controlplane $ docker push $REGISTRY/max-breast-cancer-mitosis-detector
The push refers to repository [2886795276-31500-simba10.environments.katacoda.com/max-breast-cancer-mitosis-detector]
1c7f8bc3cfe8: Pushed 
67b53aa587f9: Pushed 
abacd45f00cd: Pushing  714.5MB/714.5MB
681fa909c768: Pushed 
9584daf0ba42: Pushed 
a8b3559ecaaf: Pushed 
60d4860d7d78: Pushed 
3cb0f1d15637: Pushed 
2e78f349c467: Pushed 
6dbb9813e8b9: Pushed 
3ab2a9df44f7: Layer already exists 
f7ea9e450b7d: Pushed 
5215cb249b79: Pushed 
3ee7190fd43a: Pushed 
2db44bce66cd: Pushed 
error parsing HTTP 413 response body: invalid character '<' looking for beginning of value: "<html>\r\n<head><title>413 Request Entity Too Large</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>413 Request Entity Too Large</h1></center>\r\n<hr><center>nginx/1.15.0</center>\r\n</body>\r\n</html>\r\n"

经查看Helm文档,可以通过给helm install时设置--set ingress.annotations={nginx.ingress.kubernetes.io/proxy-body-size: "0"}来取消nginx对代理body大小的限制。我们通过编写配置文件,使用helm upgrade命令来应用配置文件,如下所示:

mkdir ./docker-registry;
cat > ./docker-registry/values-docker-registry.yml << EOF
ingress:
  enabled: true
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
EOF

# 重新通过Helm安装Registry
helm upgrade --install registry twuni/docker-registry \
--version 1.10.0 \
--namespace kube-system \
--set service.type=NodePort \
--set service.nodePort=31500 \
--values ./docker-registry/values-docker-registry.yml

上传依然遇到413问题,待debug。


总结

平时我们在K8S上部署应用,需要从零开始写deployment配置文件。而Helm为我们简化了步骤,Helm仓库中存放了常用的应用,用户只需要配置好仓库地址,直接运行helm install命令即可安装常用的应用,方便快捷。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王万林 Ben

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值