1. Introduction
For the configuration of Nexus, please refer to the previous article: https://blog.csdn.net/shida_csdn/article/details/80006645
Second, k8s integrated Nexus warehouse configuration steps
2.1 For all nodes, the certificate needs to be imported in advance. This certificate is the self-signed certificate used by Nexus. For details, please refer to [ Preliminary Summary ]
2.2 k8s creates Secret
Since the private repository needs to log in to pull the image, you need to tell k8s the username and password to use when pulling the image
Create Secret command:
kubectl create secret docker-registry docker-local --docker-server=192.168.12.129:7709 --docker-username=admin --docker-password=admin123 [email protected] --namespace=default
Where: docker-local is the key name, docker-server is the private repository address,
docker-username/docker-password are the username and password of the private warehouse, just write whatever you want in docker-email
namespace is the namespace where the key takes effect
It should be noted here that if multiple namespaces are to use private repositories, each namespace must create a Secret, explaining
2.3 Using Secret
The key is to specify the imagePullSecrets field, and note that the Secret has indeed been created under the namespace
apiVersion: v1 kind: Pod metadata: name: private-reg spec: containers: - name: private-reg-container image: <your-private-image> imagePullSecrets: - name: docker-local