Hola, tengo un puerto funcionando perfectamente en http://harbor.domain usando el ingreso de nginx, lo instalo usando el gráfico de puerto-helm.
En la terminal puedo empujar helmcharts a http://harbor.domain/chartrepo/ ,
puedo iniciar sesión
docker login harbor.domain:80y empuje al registro.
Mi desafío es que me gustaría que se acceda al puerto a través de un proxy apache, por ejemplo
Reinstalé usando el gráfico de timón de puerto cambiando values.yaml
externalURL: https://example.com Entonces, en /etc/apache2/sites-available/example-le-ssl.conf , agregué lo siguiente
# helmcharts <Location "/chartrepo/"> ProxyPass "http://harbor.domain/chartrepo/" ProxyPassReverse "http://harbor.domain/chartrepo/" </Location> # harbor <Location "/harbor"> ProxyPass "http://harbor.domain/harbor" ProxyPassReverse "http://harbor.domain/harbor" </Location> # registry <Location "/v2"> ProxyPass "http://harbor.domain/v2" ProxyPassReverse "http://harbor.domain/v2" </Location> Desafortunadamente, si docker login example.com docker login devuelve
Error response from daemon: login attempt to https://example.com/v2/ failed with status: 503 Service Unavailableme sale el siguiente error en los registros de registro
error authorizing context: authorization token required¿Alguna idea de lo que me estoy perdiendo?
Intentar empujar un gráfico también falla.
helm push --username='username' --password='password' demo-chart.tgz https://example.com/chartrepo/siendo el error
Error: 404: could not properly parse response JSON: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL was not found on this server.</p> <hr> <address>Apache/2.4.41 (Ubuntu) Server at example.com Port 443</address> </body></html>Parece que no puede autorizar el registro de Docker. Puede agregar la variable a la cuenta de servicio predeterminada o podemos crear un secreto de registro de docker y agregarlo a la implementación como imagepullsecret.
Si quiere hacer eso desde imagepullsecret, puede crear un asistente de plantilla, algo como
/* image pull secret */ {{- define "imagePullSecret" }} {{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.imageCredentials.registry (printf "%s:%s" .Values.imageCredentials.username .Values.imageCredentials.password | b64enc) | b64enc }} {{- end }}Luego puede usar eso en el archivo de implementación como
imagePullSecrets: - name: {{.Values.imageCredentials.secretName}}Todo el archivo puede verse como
apiVersion: apps/v1 kind: Deployment metadata: name: {{ .Values.appName }} namespace: {{ .Values.namespace }} spec: selector: matchLabels: app: {{ .Values.appName }} replicas: {{ .Values.replicaCount }} template: metadata: labels: app: {{ .Values.appName }} spec: containers: - name: {{ .Values.appName }} image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} {{- if .Values.hasSecretVolume }} volumeMounts: - name: {{ .Values.appName }}-volume-sec mountPath: {{ .Values.secretVolumeMountPath }} {{- end}} {{- if or .Values.env.configMap .Values.env.secrets }} envFrom: {{- if .Values.env.configMap }} - configMapRef: name: {{ .Values.appName }}-env-configmap {{- end }} {{- if .Values.env.secrets }} - secretRef: name: {{ .Values.appName }}-env-secret {{- end }} {{- end }} ports: - containerPort: {{ .Values.containerPort }} protocol: TCP {{- if .Values.springContainerHealthChecks}} {{ toYaml .Values.springContainerHealthChecks | indent 8 }} {{- end}} {{- if .Values.hasSecretVolume }} volumes: - name: {{ .Values.appName }}-volume-sec secret: secretName: {{ .Values.appName }}-volume-sec {{- end}} {{- if .Values.imageCredentials}} imagePullSecrets: - name: {{.Values.imageCredentials.secretName}} {{- end}}mi primer problema fue cómo apache maneja el proxy al backend https explicado aquí ¿cómo configurar el servidor apache para hablar con el servidor backend HTTPS? .
Agregué a mi host virtual /etc/apache2/sites-available/example-le-ssl.conf
SSLProxyEngine on SSLProxyVerify none SSLProxyCheckPeerCN off SSLProxyCheckPeerName off SSLProxyCheckPeerExpire off <Location "/v2"> ProxyPass "http://harbor.domain/v2" ProxyPassReverse "http://harbor.domain/v2" </Location> <Location "/service/"> # RequestHeader set X-Forwarded-Proto "https" ProxyPass "http://harbor.domain/service/" ProxyPassReverse "http://harbor.domain/service/" </Location>