Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
elearning:workbooks:kubernetes:k8s09 [2024/02/21 13:30] – admin | elearning:workbooks:kubernetes:k8s09 [2024/12/20 13:54] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 5: | Ligne 5: | ||
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
- | ======DOF310 | + | |
+ | ======DOF310 - StatefulSets, | ||
=====Contenu du Module===== | =====Contenu du Module===== | ||
- | * **DOF310 | + | * **DOF310 - StatefulSets, |
* Contenu du Module | * Contenu du Module | ||
* StatefulSets | * StatefulSets | ||
Ligne 36: | Ligne 37: | ||
* 4.2 - Consultation des Données avec Grafana | * 4.2 - Consultation des Données avec Grafana | ||
* 4.3 - Consultation des Alertes avec le Web UI de Prometheus | * 4.3 - Consultation des Alertes avec le Web UI de Prometheus | ||
- | * Harbor | + | |
- | * LAB #5 - Installation et Configuration de Harbor | + | =====Ressources===== |
- | * 5.1 - Installation de Docker et de Docker Compose | + | |
- | * 5.2 - Installation de Harbor | + | ====Lab |
- | * 5.3 - Création d'un Nouveau Projet | + | |
- | * 5.4 - Création d'un Dépôt | + | * https://www.dropbox.com/ |
- | * 5.5 - Pousser des Images Supplémentaires | + | * https://www.dropbox.com/ |
- | * 5.6 - Travailler avec des Artefacts | + | |
- | * 5.7 - Copier un Artefact d'un Projet vers un autre Projet | + | ====Lab #2==== |
- | * 5.8 - Utilisation de Labels | + | |
- | * 5.9 - Authentification et RBAC | + | * https://www.dropbox.com/ |
- | * 5.10 - Utilisation d' | + | * https://www.dropbox.com/ |
- | * 5.11 - Rétention de Tags | + | * https://www.dropbox.com/ |
- | * 5.12 - Immutabilité des Tags | + | |
+ | ====Lab #3==== | ||
+ | |||
+ | | ||
+ | * https://www.dropbox.com/ | ||
+ | * https://www.dropbox.com/ | ||
+ | * https://www.dropbox.com/ | ||
+ | * https://www.dropbox.com/ | ||
=====StatefulSets===== | =====StatefulSets===== | ||
Ligne 383: | Ligne 391: | ||
statefulset.apps " | statefulset.apps " | ||
- | root@kubemaster: | + | root@kubemaster: |
service " | service " | ||
Ligne 1626: | Ligne 1634: | ||
{{ : | {{ : | ||
- | |||
- | =====Harbor===== | ||
- | |||
- | **Harbor** est un registre open source qui : | ||
- | |||
- | * sécurise les artefacts (images) avec des politiques | ||
- | * utilise un contrôle d' | ||
- | * garantit que les images sont analysées et exemptes de vulnérabilités | ||
- | * signe les images comme fiables. | ||
- | |||
- | ====LAB #5 - Installation et Configuration de Harbor==== | ||
- | |||
- | ===5.1 - Installation de Docker et de Docker Compose=== | ||
- | |||
- | Connectez-vous à votre instance de Debian11 en tant que trainee au 10.0.2.46 puis devenez l' | ||
- | |||
- | Installez les dépendances de Docker : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Téléchargez la clef GPG officielle de docker : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | OK | ||
- | </ | ||
- | |||
- | Ajoutez le dépôt stable de docker : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Installez maintenant **docker-ce** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Téléchargez docker-compose : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Rendez docker-compose exécutable et déplacez-le dans le répertoire **/ | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | |||
- | root@debian11: | ||
- | </ | ||
- | |||
- | ===5.2 - Installation de Harbor=== | ||
- | |||
- | Téléchargez Harbor : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Désarchivez Harbor : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | harbor/ | ||
- | harbor/ | ||
- | harbor/ | ||
- | harbor/ | ||
- | harbor/ | ||
- | harbor/ | ||
- | </ | ||
- | |||
- | Placez-vous dans le répertoire **harbor** et copiez le fichier **harbor.yml.tmpl** vers **harbor.yml** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | |||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Créez le fichier **/ | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | { | ||
- | " | ||
- | } | ||
- | </ | ||
- | |||
- | Modifiez maintenant l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | # Configuration file of Harbor | ||
- | |||
- | # The IP address or hostname to access admin UI and registry service. | ||
- | # DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients. | ||
- | hostname: 10.0.2.46 | ||
- | |||
- | # http related config | ||
- | http: | ||
- | # port for http, default is 80. If https enabled, this port will redirect to https port | ||
- | port: 80 | ||
- | |||
- | # https related config | ||
- | # https: | ||
- | # https port for harbor, default is 443 | ||
- | # port: 443 | ||
- | # The path of cert and key files for nginx | ||
- | # certificate: | ||
- | # private_key: | ||
- | |||
- | # # Uncomment following will enable tls communication between all harbor components | ||
- | </ | ||
- | |||
- | Constatez la présence du script **install.sh** dans le répertoire **harbor/** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | common.sh | ||
- | harbor.v2.6.2.tar.gz | ||
- | </ | ||
- | |||
- | Désactivez le service nginx dans la VM Debian11 : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | |||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Installez maintenant Harbor avec le support pour **Chart Museum** et **Trivy** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | |||
- | [Step 0]: checking if docker is installed ... | ||
- | |||
- | Note: docker version: 20.10.21 | ||
- | |||
- | [Step 1]: checking docker-compose is installed ... | ||
- | |||
- | Note: docker-compose version: 2.14.0 | ||
- | |||
- | [Step 2]: loading Harbor images ... | ||
- | ... | ||
- | [Step 3]: preparing environment ... | ||
- | ... | ||
- | [Step 4]: preparing harbor configs ... | ||
- | ... | ||
- | [Step 5]: starting Harbor ... | ||
- | ➜ | ||
- | Chartmusuem will be deprecated as of Harbor v2.6.0 and start to be removed in v2.8.0 or later. | ||
- | Please see discussion here for more details. https:// | ||
- | [+] Running 13/13 | ||
- | ⠿ Network harbor_harbor | ||
- | ⠿ Network harbor_harbor-chartmuseum | ||
- | ⠿ Container harbor-log | ||
- | ⠿ Container registry | ||
- | ⠿ Container registryctl | ||
- | ⠿ Container harbor-portal | ||
- | ⠿ Container redis Started | ||
- | ⠿ Container chartmuseum | ||
- | ⠿ Container harbor-db | ||
- | ⠿ Container trivy-adapter | ||
- | ⠿ Container harbor-core | ||
- | ⠿ Container nginx Started | ||
- | ⠿ Container harbor-jobservice | ||
- | ✔ ----Harbor has been installed and started successfully.---- | ||
- | </ | ||
- | |||
- | Constatez les conteneurs créés par l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | CONTAINER ID | ||
- | b8e4e3934c7a | ||
- | 579b4b43877f | ||
- | 57c8697b4d39 | ||
- | ce4823c62886 | ||
- | 57992f8f573a | ||
- | e2df863f7009 | ||
- | 3e7e2093a4a2 | ||
- | 406aa384c742 | ||
- | ddf08dcc8390 | ||
- | b5cedbab739d | ||
- | 13665ace83fd | ||
- | </ | ||
- | |||
- | Ainsi que les images téléchargées : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | REPOSITORY | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | </ | ||
- | |||
- | Constatez maintenant les réseaux créés par l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | NETWORK ID | ||
- | c080bf952007 | ||
- | 380a2401fb01 | ||
- | b5d0cc4623f6 | ||
- | 3e48278ae275 | ||
- | 4dd9174d8e25 | ||
- | </ | ||
- | |||
- | ===5.3 - Création d'un Nouveau Projet=== | ||
- | |||
- | Connectez-vous à votre VM **Gateway_10.0.2.40_VNC** et ouvrez le navigateur web. Allez à l'URL http:// | ||
- | |||
- | {{ : | ||
- | |||
- | Connectez-vous avec les identifiants par défaut - admin / Harbor12345 : | ||
- | |||
- | {{ : | ||
- | |||
- | Harbor est organisé autour de **Projets**. Dans un projet se trouvent des **Dépôts** ou // | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que la valeur de **-1** indique que le projet a un quota de disque **illimité**. | ||
- | </ | ||
- | |||
- | Cliquez sur le bouton **OK** puis cliquez sur le nom **myproject** : | ||
- | |||
- | {{ : | ||
- | |||
- | ===5.4 - Création d'un Dépôt=== | ||
- | |||
- | Téléchargez maintenant l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Using default tag: latest | ||
- | latest: Pulling from library/ | ||
- | 2db29710123e: | ||
- | Digest: sha256: | ||
- | Status: Downloaded newer image for hello-world: | ||
- | docker.io/ | ||
- | </ | ||
- | |||
- | Retournez dans Harbor et cliquez sur **PUSH COMMAND** à droite. Dans la liste des commandes vous vous apercevrez la commande pour //tagger// une image pour le porjet **myproject** : | ||
- | |||
- | {{ : | ||
- | |||
- | Copiez cette commande puis modifiez la ainsi : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | |||
- | root@debian11: | ||
- | REPOSITORY | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | hello-world | ||
- | 10.0.2.46: | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez la spécification du port **80**. Sans spécifier le port le port par défaut **443** serait utilisé. | ||
- | </ | ||
- | |||
- | Connectez-vous à Harbor : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Username: admin | ||
- | Password: Harbor12345 | ||
- | Error response from daemon: Get " | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez l' | ||
- | </ | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | { | ||
- | " | ||
- | } | ||
- | </ | ||
- | |||
- | Modifiez donc ce fichier : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | { | ||
- | " | ||
- | } | ||
- | </ | ||
- | |||
- | Redémarrez le service docker : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | ● docker.service - Docker Application Container Engine | ||
- | | ||
- | | ||
- | TriggeredBy: | ||
- | Docs: https:// | ||
- | Main PID: 487567 (dockerd) | ||
- | Tasks: 44 | ||
- | | ||
- | CPU: 2.275s | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | Dec 11 08:57:14 debian11 dockerd[487567]: | ||
- | Dec 11 08:57:14 debian11 dockerd[487567]: | ||
- | Dec 11 08:57:19 debian11 dockerd[487567]: | ||
- | Dec 11 08:57:21 debian11 dockerd[487567]: | ||
- | Dec 11 08:57:21 debian11 dockerd[487567]: | ||
- | Dec 11 08:57:31 debian11 dockerd[487567]: | ||
- | Dec 11 08:57:35 debian11 dockerd[487567]: | ||
- | Dec 11 08:57:36 debian11 dockerd[487567]: | ||
- | </ | ||
- | |||
- | Maintenant redémarrez Harbor : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | [+] Running 13/13 | ||
- | ⠿ Container harbor-jobservice | ||
- | ⠿ Container nginx Removed | ||
- | ⠿ Container chartmuseum | ||
- | ⠿ Container trivy-adapter | ||
- | ⠿ Container registryctl | ||
- | ⠿ Container harbor-portal | ||
- | ⠿ Container harbor-core | ||
- | ⠿ Container harbor-db | ||
- | ⠿ Container registry | ||
- | ⠿ Container redis Removed | ||
- | ⠿ Container harbor-log | ||
- | ⠿ Network harbor_harbor | ||
- | ⠿ Network harbor_harbor-chartmuseum | ||
- | |||
- | root@debian11: | ||
- | [+] Running 13/13 | ||
- | ⠿ Network harbor_harbor | ||
- | ⠿ Network harbor_harbor-chartmuseum | ||
- | ⠿ Container harbor-log | ||
- | ⠿ Container harbor-db | ||
- | ⠿ Container harbor-portal | ||
- | ⠿ Container chartmuseum | ||
- | ⠿ Container redis Started | ||
- | ⠿ Container registryctl | ||
- | ⠿ Container registry | ||
- | ⠿ Container trivy-adapter | ||
- | ⠿ Container harbor-core | ||
- | ⠿ Container harbor-jobservice | ||
- | ⠿ Container nginx Started | ||
- | </ | ||
- | |||
- | Connectez-vous à Harbor : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Username: admin | ||
- | Password: | ||
- | WARNING! Your password will be stored unencrypted in / | ||
- | Configure a credential helper to remove this warning. See | ||
- | https:// | ||
- | |||
- | Login Succeeded | ||
- | </ | ||
- | |||
- | Les coordonnées de connexion sont stockées dans le fichier **/ | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | { | ||
- | " | ||
- | " | ||
- | " | ||
- | } | ||
- | } | ||
- | }root@debian11: | ||
- | </ | ||
- | |||
- | De cette façon, lors des logins futur, docker ne demandera ni le nom de l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Removing login credentials for https:// | ||
- | |||
- | root@debian11: | ||
- | Authenticating with existing credentials... | ||
- | WARNING! Your password will be stored unencrypted in / | ||
- | Configure a credential helper to remove this warning. See | ||
- | https:// | ||
- | |||
- | Login Succeeded | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Using default tag: latest | ||
- | The push refers to repository [10.0.2.46: | ||
- | e07ee1baac5f: | ||
- | latest: digest: sha256: | ||
- | </ | ||
- | |||
- | Retournez à Harbor et constatez la présence du dépôt : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur le nom du dépôt et constatez son contenu : | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que l' | ||
- | </ | ||
- | |||
- | ===5.5 - Pousser des Images Supplémentaires=== | ||
- | |||
- | Modifiez le tag de l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | e07ee1baac5f: | ||
- | 1.0: digest: sha256: | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que la valeur du SHA256 est indentique au push précédent. De cette façon Docker n'a pas poussé l' | ||
- | </ | ||
- | |||
- | Constatez le résultat dans Harbor : | ||
- | |||
- | {{ : | ||
- | |||
- | Téléchargez maintenant l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Using default tag: latest | ||
- | latest: Pulling from library/ | ||
- | c158987b0551: | ||
- | Digest: sha256: | ||
- | Status: Downloaded newer image for alpine: | ||
- | docker.io/ | ||
- | </ | ||
- | |||
- | Modifiez le tag de l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Using default tag: latest | ||
- | The push refers to repository [10.0.2.46: | ||
- | ded7a220bb05: | ||
- | latest: digest: sha256: | ||
- | </ | ||
- | |||
- | Constatez le résultat dans Harbor : | ||
- | |||
- | {{ : | ||
- | |||
- | ===5.6 - Travailler avec des Artefacts=== | ||
- | |||
- | Cliquez sur **Projects > myproject > myproject/ | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez ensuite sur le bouton **ADD TAG** et ajoutez le tag **anothertag** : | ||
- | |||
- | {{ : | ||
- | |||
- | Sur la ligne 1.0 et dans la colonne **Pull Command**, cliquez sur l' | ||
- | |||
- | {{ : | ||
- | |||
- | Revenez à l' | ||
- | |||
- | < | ||
- | REPOSITORY | ||
- | 10.0.2.46: | ||
- | alpine | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | 10.0.2.46: | ||
- | 10.0.2.46: | ||
- | hello-world | ||
- | </ | ||
- | |||
- | Supprimez l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Untagged: 10.0.2.46: | ||
- | </ | ||
- | |||
- | Consultez la liste des images de nouveau : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | REPOSITORY | ||
- | 10.0.2.46: | ||
- | alpine | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | 10.0.2.46: | ||
- | hello-world | ||
- | </ | ||
- | |||
- | Téléchargez maintenant l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | 1.0: Pulling from myproject/ | ||
- | Digest: sha256: | ||
- | Status: Downloaded newer image for 10.0.2.46: | ||
- | 10.0.2.46: | ||
- | </ | ||
- | |||
- | Lister maintenant les images : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | REPOSITORY | ||
- | 10.0.2.46: | ||
- | alpine | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | hello-world | ||
- | 10.0.2.46: | ||
- | 10.0.2.46: | ||
- | </ | ||
- | |||
- | Modifiez le tag de l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | |||
- | root@debian11: | ||
- | REPOSITORY | ||
- | 10.0.2.46: | ||
- | alpine | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | 10.0.2.46: | ||
- | 10.0.2.46: | ||
- | 10.0.2.46: | ||
- | hello-world | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | e07ee1baac5f: | ||
- | latest: digest: sha256: | ||
- | </ | ||
- | |||
- | ===5.7 - Copier un Artefact d'un Projet vers un autre Projet=== | ||
- | |||
- | Commencez par créer un autre projet appelé **devtest** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **Projects > myproject > myproject/ | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez ensuite sur **ACTIONS > Copy** : | ||
- | |||
- | {{ : | ||
- | |||
- | Renseignez les champs et cliquez sur le bouton **CONFIRM** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **Projects > devtest** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez ensuite sur **devtest/ | ||
- | |||
- | {{ : | ||
- | |||
- | ===5.8 - Suppression d'un Artefact, d'un Dépôt et d'un Projet=== | ||
- | |||
- | Sélectionnez l' | ||
- | |||
- | {{ : | ||
- | |||
- | Confirmez la suppression en cliquant sur le bouton **CONFIRM** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **devtest** et cochez **devtest/ | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur le bouton **DELETE** : | ||
- | |||
- | {{ : | ||
- | |||
- | Confirmez la suppression en cliquant sur le bouton **CONFIRM** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **Projects** puis cochez **devtest** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **ACTION** puis sur **Delete** : | ||
- | |||
- | {{ : | ||
- | |||
- | Confirmez la suppression en cliquant sur le bouton **CONFIRM** : | ||
- | |||
- | {{ : | ||
- | |||
- | ===5.8 - Utilisation de Labels=== | ||
- | |||
- | Harbor gère des **Labels** ou étiquettes. Ces étiquettes peuvent être globales ou spécifiques à un Projet. Quand une étiquette est spécifique, | ||
- | |||
- | Cliquez sur **Labels** dans Harbor : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **NEW LABEL** et créez les deux étiquettes suivantes : | ||
- | |||
- | * **gtested** - global tested | ||
- | * **gprodready** global production ready | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **Projects > myproject > myproject/ | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **ACTIONS** > **Add Labels** puis sélectionnez **gtested** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez maintenant sur **myproject > Labels** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez ensuite sur **NEW LABEL** et créez ensuite une étiguette spécifique au projet appelé **myproject-deploy** ayant une description **myproject label** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **Repositories > myproject/ | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **ACTIONS** > **Add Labels** et sélectionnez l' | ||
- | |||
- | {{ : | ||
- | |||
- | Pour visualiser toutes les étiguettes, | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **Projects > NEW PROJECT** et créez le projet **project2** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **project2 > Labels > NEW LABEL** et créez l' | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **Projects > myproject > myproject/ | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **ACTIONS** > **Add Labels** : | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que l' | ||
- | </ | ||
- | |||
- | ===5.9 - Authentification et RBAC=== | ||
- | |||
- | Cliquez sur **Users** puis sur **NEW USER** et creéz l' | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que pour être valide le mot de passe doit comporter une lettre Majuscule et un chiffre. | ||
- | </ | ||
- | |||
- | Sélectionnez l' | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **Projects > myproject** puis sur **Members** et **+ USER** : | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Pour consulter les privilèges de chaque rôle, cliquez sur **[[https:// | ||
- | </ | ||
- | |||
- | Cliquez sur **OK** et sélectionnez l' | ||
- | |||
- | {{ : | ||
- | |||
- | Pour modifier son rôle, cliquez sur **ACTION** et choississez le rôle désiré : | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que le bouton **+ GROUP** est grisé. Si un Active Directory ou bien LDAP avait été configuré, Harbor pourrait lire la liste des groupes et n ous permettrait d' | ||
- | </ | ||
- | |||
- | ===5.10 - Utilisation d' | ||
- | |||
- | Créez un répertoire nommé myDocker : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Créez le fichier myEntrypoint.sh : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | #!/bin/bash | ||
- | if [ -z " | ||
- | echo "La variable myVariable doit être renseignée" | ||
- | return 1 | ||
- | fi | ||
- | |||
- | while true; | ||
- | do | ||
- | echo $1 \($(date +%H: | ||
- | sleep " | ||
- | done | ||
- | </ | ||
- | |||
- | Testez ce script : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | salut (16:12:59) | ||
- | salut (16:13:02) | ||
- | salut (16:13:05) | ||
- | ^C | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Rendez ce script exécutable : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | </ | ||
- | |||
- | Créez maintenant le fichier **Dockerfile** dans le répertoire **~/ | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | FROM centos: | ||
- | MAINTAINER ittraining " | ||
- | COPY myEntrypoint.sh / | ||
- | ENV myVariable 3 | ||
- | ENTRYPOINT ["/ | ||
- | CMD [" | ||
- | </ | ||
- | |||
- | Connectez-vous à Harbor : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Authenticating with existing credentials... | ||
- | WARNING! Your password will be stored unencrypted in / | ||
- | Configure a credential helper to remove this warning. See | ||
- | https:// | ||
- | |||
- | Login Succeeded | ||
- | </ | ||
- | |||
- | Générez maintenant l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Sending build context to Docker daemon | ||
- | Step 1/6 : FROM centos: | ||
- | latest: Pulling from library/ | ||
- | a1d0c7532777: | ||
- | Digest: sha256: | ||
- | Status: Downloaded newer image for centos: | ||
- | | ||
- | Step 2/6 : MAINTAINER ittraining " | ||
- | | ||
- | Removing intermediate container 7e359420ea95 | ||
- | | ||
- | Step 3/6 : COPY myEntrypoint.sh / | ||
- | | ||
- | Step 4/6 : ENV myVariable 3 | ||
- | | ||
- | Removing intermediate container edf989144c38 | ||
- | | ||
- | Step 5/6 : ENTRYPOINT ["/ | ||
- | | ||
- | Removing intermediate container 0490b6a50bbc | ||
- | | ||
- | Step 6/6 : CMD [" | ||
- | | ||
- | Removing intermediate container e2ecfea5be53 | ||
- | | ||
- | Successfully built ccb27534d7f2 | ||
- | Successfully tagged 10.0.2.46: | ||
- | |||
- | root@debian11: | ||
- | REPOSITORY | ||
- | 10.0.2.46: | ||
- | 10.0.2.46: | ||
- | alpine | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | goharbor/ | ||
- | 10.0.2.46: | ||
- | hello-world | ||
- | 10.0.2.46: | ||
- | 10.0.2.46: | ||
- | centos | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | 7c7558b01004: | ||
- | 74ddd0ec08fa: | ||
- | latest: digest: sha256: | ||
- | </ | ||
- | |||
- | Retournez à l' | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que le dépôt **myproject/ | ||
- | </ | ||
- | |||
- | Cliquez sur **myproject/ | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que l' | ||
- | </ | ||
- | |||
- | Refaites un build de l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Sending build context to Docker daemon | ||
- | Step 1/6 : FROM centos: | ||
- | | ||
- | Step 2/6 : MAINTAINER ittraining " | ||
- | | ||
- | | ||
- | Step 3/6 : COPY myEntrypoint.sh / | ||
- | | ||
- | | ||
- | Step 4/6 : ENV myVariable 3 | ||
- | | ||
- | | ||
- | Step 5/6 : ENTRYPOINT ["/ | ||
- | | ||
- | | ||
- | Step 6/6 : CMD [" | ||
- | | ||
- | | ||
- | Successfully built ccb27534d7f2 | ||
- | Successfully tagged 10.0.2.46: | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez l' | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | 7c7558b01004: | ||
- | 74ddd0ec08fa: | ||
- | rel1: digest: sha256: | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que seul le nouveau tag a été poussé. | ||
- | </ | ||
- | |||
- | Editez le Dockerfile et changez la valeur de **myVariable** de 3 à **5** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | FROM centos: | ||
- | MAINTAINER ittraining " | ||
- | COPY myEntrypoint.sh / | ||
- | ENV myVariable 5 | ||
- | ENTRYPOINT ["/ | ||
- | CMD [" | ||
- | </ | ||
- | |||
- | Compilez de nouveau l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Sending build context to Docker daemon | ||
- | Step 1/6 : FROM centos: | ||
- | | ||
- | Step 2/6 : MAINTAINER ittraining " | ||
- | | ||
- | | ||
- | Step 3/6 : COPY myEntrypoint.sh / | ||
- | | ||
- | | ||
- | Step 4/6 : ENV myVariable 5 | ||
- | | ||
- | Removing intermediate container c90f60beee6f | ||
- | | ||
- | Step 5/6 : ENTRYPOINT ["/ | ||
- | | ||
- | Removing intermediate container 8aabb88b172d | ||
- | | ||
- | Step 6/6 : CMD [" | ||
- | | ||
- | Removing intermediate container 8e1bd939a7c2 | ||
- | | ||
- | Successfully built 9a12b543b94b | ||
- | Successfully tagged 10.0.2.46: | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | 7c7558b01004: | ||
- | 74ddd0ec08fa: | ||
- | rel2: digest: sha256: | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que la valeur du SHA256 de rel2 est différente - **b918acd244c70cf528d8e96584d8d34099d2a8eefc1edd86ba972dd975934f52** par rapport à **323ab8f05733ac369963b338bb8fe81bd5cb2d77b46ac3650b7924e7da3aa9cf**. | ||
- | </ | ||
- | |||
- | De ce fait un nouvel Artefact a été créé : | ||
- | |||
- | {{ : | ||
- | |||
- | Editez le Dockerfile et changez la valeur de **CMD** de " | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | FROM centos: | ||
- | MAINTAINER ittraining " | ||
- | COPY myEntrypoint.sh / | ||
- | ENV myVariable 5 | ||
- | ENTRYPOINT ["/ | ||
- | CMD [" | ||
- | </ | ||
- | |||
- | Compilez de nouveau l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Sending build context to Docker daemon | ||
- | Step 1/6 : FROM centos: | ||
- | | ||
- | Step 2/6 : MAINTAINER ittraining " | ||
- | | ||
- | | ||
- | Step 3/6 : COPY myEntrypoint.sh / | ||
- | | ||
- | | ||
- | Step 4/6 : ENV myVariable 5 | ||
- | | ||
- | | ||
- | Step 5/6 : ENTRYPOINT ["/ | ||
- | | ||
- | | ||
- | Step 6/6 : CMD [" | ||
- | | ||
- | Removing intermediate container ac174f91145b | ||
- | | ||
- | Successfully built 56cc6362dc99 | ||
- | Successfully tagged 10.0.2.46: | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | 7c7558b01004: | ||
- | 74ddd0ec08fa: | ||
- | rel2: digest: sha256: | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que la valeur du SHA256 de rel2 est différente - **fcf710f98e14ac3df4d3cf365f04423da8ceb42325eca9efe87f67082904728e** par rapport à **b918acd244c70cf528d8e96584d8d34099d2a8eefc1edd86ba972dd975934f52**. Par contre, puisque le même tag a été utilisé, le tag **rel2** a été attribué au dernier Artefact créé et le même tag a été supprimé de l' | ||
- | </ | ||
- | |||
- | ===5.11 - Rétention de Tags=== | ||
- | |||
- | Pour gérer ce comportement, | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **ADD RULE** et remplissez le formulaire ainsi : | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Cette règle s' | ||
- | </ | ||
- | |||
- | Cliquez sur **EDIT** sur la ligne **Schedule** et choisissez **hourly** puis cliquez **Save** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur **OK** dans la boîte d' | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez ensuite sur le bouton **DRY RUN**. Quand le Dry Run a terminé avec le message **Success**, | ||
- | |||
- | {{ : | ||
- | |||
- | Sur la dernière ligne, cliquez sur le bouton **Log** : | ||
- | |||
- | {{ : | ||
- | |||
- | Consultez la colonne **Retention** : | ||
- | |||
- | {{ : | ||
- | |||
- | Revenez dans l' | ||
- | |||
- | {{ : | ||
- | |||
- | Editez de nouveau le Dockerfile et changez la valeur de **myVariable** de 5 à **10** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | FROM centos: | ||
- | MAINTAINER ittraining " | ||
- | COPY myEntrypoint.sh / | ||
- | ENV myVariable 10 | ||
- | ENTRYPOINT ["/ | ||
- | CMD [" | ||
- | </ | ||
- | |||
- | Compilez de nouveau l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Sending build context to Docker daemon | ||
- | Step 1/6 : FROM centos: | ||
- | | ||
- | Step 2/6 : MAINTAINER ittraining " | ||
- | | ||
- | | ||
- | Step 3/6 : COPY myEntrypoint.sh / | ||
- | | ||
- | | ||
- | Step 4/6 : ENV myVariable 10 | ||
- | | ||
- | Removing intermediate container 7c938717175f | ||
- | | ||
- | Step 5/6 : ENTRYPOINT ["/ | ||
- | | ||
- | Removing intermediate container b2dc04a9363d | ||
- | | ||
- | Step 6/6 : CMD [" | ||
- | | ||
- | Removing intermediate container fd7a8952dd7f | ||
- | | ||
- | Successfully built 3bbe34d8d430 | ||
- | Successfully tagged 10.0.2.46: | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | 7c7558b01004: | ||
- | 74ddd0ec08fa: | ||
- | rel3: digest: sha256: | ||
- | </ | ||
- | |||
- | Exécutez la règle : | ||
- | |||
- | {{ : | ||
- | |||
- | Constatez la liste des Artefacts dans **mydocker** : | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que c'est l' | ||
- | </ | ||
- | |||
- | ===5.12 - Immutabilité des Tags=== | ||
- | |||
- | Cliquez sur **myproject > Policy > TAG IMMUTABILITY** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez maintenant sur le bouton **ADD RULE** : | ||
- | |||
- | {{ : | ||
- | |||
- | Cliquez sur le bouton **ADD** : | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Cette règle s' | ||
- | </ | ||
- | |||
- | Essayez de faire un push de l' | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | 7c7558b01004: | ||
- | 74ddd0ec08fa: | ||
- | unknown: Failed to process request due to ' | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez qu'il n'est pas possible de faire un push car la règle d' | ||
- | </ | ||
- | |||
- | Editez le Dockerfile et changez la valeur de **myVariable** de 10 à **8** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | FROM centos: | ||
- | MAINTAINER ittraining " | ||
- | COPY myEntrypoint.sh / | ||
- | ENV myVariable 8 | ||
- | ENTRYPOINT ["/ | ||
- | CMD [" | ||
- | </ | ||
- | |||
- | Faites un build de **mydocker: | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Sending build context to Docker daemon | ||
- | Step 1/6 : FROM centos: | ||
- | | ||
- | Step 2/6 : MAINTAINER ittraining " | ||
- | | ||
- | | ||
- | Step 3/6 : COPY myEntrypoint.sh / | ||
- | | ||
- | | ||
- | Step 4/6 : ENV myVariable 8 | ||
- | | ||
- | Removing intermediate container 541758cf561f | ||
- | | ||
- | Step 5/6 : ENTRYPOINT ["/ | ||
- | | ||
- | Removing intermediate container 9d309f201613 | ||
- | | ||
- | Step 6/6 : CMD [" | ||
- | | ||
- | Removing intermediate container e7397e408526 | ||
- | | ||
- | Successfully built 85f1cbc19cee | ||
- | Successfully tagged 10.0.2.46: | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | 7c7558b01004: | ||
- | 74ddd0ec08fa: | ||
- | rel4: digest: sha256: | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez qu'il est possible de faire un push car le tag rel4 n' | ||
- | </ | ||
- | |||
- | Dans l' | ||
- | |||
- | {{ : | ||
- | |||
- | Essayez de supprimer l' | ||
- | |||
- | {{ : | ||
- | |||
- | Notez l' | ||
- | |||
- | {{ : | ||
- | |||
- | Pour pouvoir supprimer l' | ||
- | |||
- | {{ : | ||
- | |||
- | Maintenant, essayez de supprimer l' | ||
- | |||
- | {{ : | ||
- | |||
- | Vous verrez que la suppression a réussi : | ||
- | |||
- | {{ : | ||
- | |||
- | Editez le Dockerfile et changez la valeur de **myVariable** de 8 à **7** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | root@debian11: | ||
- | FROM centos: | ||
- | MAINTAINER ittraining " | ||
- | COPY myEntrypoint.sh / | ||
- | ENV myVariable 7 | ||
- | ENTRYPOINT ["/ | ||
- | CMD [" | ||
- | </ | ||
- | |||
- | Faites un build de **mydocker: | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | Sending build context to Docker daemon | ||
- | Step 1/6 : FROM centos: | ||
- | | ||
- | Step 2/6 : MAINTAINER ittraining " | ||
- | | ||
- | | ||
- | Step 3/6 : COPY myEntrypoint.sh / | ||
- | | ||
- | | ||
- | Step 4/6 : ENV myVariable 7 | ||
- | | ||
- | Removing intermediate container b2153c9b0781 | ||
- | | ||
- | Step 5/6 : ENTRYPOINT ["/ | ||
- | | ||
- | Removing intermediate container 81b97d9082ed | ||
- | | ||
- | Step 6/6 : CMD [" | ||
- | | ||
- | Removing intermediate container 7252818184fc | ||
- | | ||
- | Successfully built f9466edbe1f3 | ||
- | Successfully tagged 10.0.2.46: | ||
- | </ | ||
- | |||
- | Procédez maintenant au **push** : | ||
- | |||
- | < | ||
- | root@debian11: | ||
- | The push refers to repository [10.0.2.46: | ||
- | 7c7558b01004: | ||
- | 74ddd0ec08fa: | ||
- | rel5: digest: sha256: | ||
- | </ | ||
- | |||
- | Pour pouvoir supprimer l' | ||
- | |||
- | {{ : | ||
- | |||
- | Maintenant, essayez de supprimer l' | ||
- | |||
- | {{ : | ||
- | |||
- | Vous verrez que la suppression a réussi : | ||
- | |||
- | {{ : | ||
- | |||
- | Retournez dans Harbor et modifier la règle d' | ||
- | |||
- | {{ : | ||
- | |||
- | Rappelez-vous que la règle de Rétention de Tags ne garde que les deux Artefacts les plus récents : | ||
- | |||
- | {{ : | ||
- | |||
- | Procédez à un Dry Run de la règle de Rétention de Tags et consultez le log de mydocker : | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **Important** : Notez que la règle d' | ||
- | </ | ||
----- | ----- | ||
Copyright © 2024 Hugh Norris | Copyright © 2024 Hugh Norris |