Shell scripts logs should be easier to follow
When running the deploy
script, following the output is not simple, there are many informations from helm
commands, kubectl
commands, etc.
We should, at least, display information about progression of the script itself to facilitate the contextualisation of sub-commands outputs:
example of logs improvement
Create namespaces
=================
namespace/laboite created
namespace/ingress-nginx created
Add helm repositories
=====================
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"ingress-nginx" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"codecentric" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"bitnami" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"eole" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"minio" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"jetstack" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "ingress-nginx" chart repository
...Successfully got an update from the "minio" chart repository
...Successfully got an update from the "codecentric" chart repository
...Successfully got an update from the "eole" chart repository
...Successfully got an update from the "jetstack" chart repository
...Successfully got an update from the "gitlab" chart repository
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈
Install cert-manager
====================
Install cert-manager v1.10.0 with options:
- --namespace gitlab
- --create-namespace
- --set installCRDs=true
- --set prometheus.enabled=false
Configure HTTP01 issuer:
clusterissuer.cert-manager.io/letsencrypt-prod unchanged
[…]
It may help to spot where things are going wrong when comparing log output and the script.
The logs should be saved to a log file.
actual logs of bash ./deploy
bash ./deploy
namespace/laboite created
namespace/ingress-nginx created
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"ingress-nginx" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"codecentric" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"bitnami" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"eole" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"minio" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
"jetstack" already exists with the same configuration, skipping
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "ingress-nginx" chart repository
...Successfully got an update from the "minio" chart repository
...Successfully got an update from the "codecentric" chart repository
...Successfully got an update from the "eole" chart repository
...Successfully got an update from the "jetstack" chart repository
...Successfully got an update from the "gitlab" chart repository
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈
clusterissuer.cert-manager.io/letsencrypt-prod unchanged
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
NAME: ingress-nginx
LAST DEPLOYED: Tue Nov 22 17:12:16 2022
NAMESPACE: ingress-nginx
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The ingress-nginx controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace ingress-nginx get services -o wide -w ingress-nginx-controller'
An example Ingress that makes use of the controller:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example
namespace: foo
spec:
ingressClassName: laboite-nginx
rules:
- host: www.example.com
http:
paths:
- pathType: Prefix
backend:
service:
name: exampleService
port:
number: 80
path: /
# This section is only required if TLS is to be enabled for the Ingress
tls:
- hosts:
- www.example.com
secretName: example-tls
If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:
apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt: <base64 encoded cert>
tls.key: <base64 encoded key>
type: kubernetes.io/tls
pod/ingress-nginx-controller-59b5bfddfd-rxf9n condition met
secret/realm-secret created
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
W1122 17:12:35.007517 217921 warnings.go:70] autoscaling/v2beta2 HorizontalPodAutoscaler is deprecated in v1.23+, unavailable in v1.26+; use autoscaling/v2 HorizontalPodAutoscaler
W1122 17:12:35.470242 217921 warnings.go:70] autoscaling/v2beta2 HorizontalPodAutoscaler is deprecated in v1.23+, unavailable in v1.26+; use autoscaling/v2 HorizontalPodAutoscaler
NAME: keycloak
LAST DEPLOYED: Tue Nov 22 17:12:34 2022
NAMESPACE: laboite
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
***********************************************************************
* *
* Keycloak Helm Chart by codecentric AG *
* *
***********************************************************************
Keycloak was installed with an Ingress and an be reached at the following URL(s):
- https://auth.mim-libre.eole3.dev/
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
NAME: mongo-laboite
LAST DEPLOYED: Tue Nov 22 17:12:37 2022
NAMESPACE: laboite
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: mongodb
CHART VERSION: 12.0.0
APP VERSION: 5.0.8
** Please be patient while the chart is being deployed **
MongoDB® can be accessed on the following DNS name(s) and ports from within your cluster:
mongo-laboite-mongodb-0.mongo-laboite-mongodb-headless.laboite.svc.cluster.local:27017
mongo-laboite-mongodb-1.mongo-laboite-mongodb-headless.laboite.svc.cluster.local:27017
mongo-laboite-mongodb-2.mongo-laboite-mongodb-headless.laboite.svc.cluster.local:27017
mongo-laboite-mongodb-3.mongo-laboite-mongodb-headless.laboite.svc.cluster.local:27017
mongo-laboite-mongodb-4.mongo-laboite-mongodb-headless.laboite.svc.cluster.local:27017
To get the root password run:
export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace laboite mongo-laboite-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)
To get the password for "laboite" run:
export MONGODB_PASSWORD=$(kubectl get secret --namespace laboite mongo-laboite-mongodb -o jsonpath="{.data.mongodb-passwords}" | base64 --decode | awk -F',' '{print $1}')
To connect to your database, create a MongoDB® client container:
kubectl run --namespace laboite mongo-laboite-mongodb-client --rm --tty -i --restart='Never' --env="MONGODB_ROOT_PASSWORD=$MONGODB_ROOT_PASSWORD" --image docker.io/bitnami/mongodb:6
.0.2-debian-11-r16 --command -- bash
Then, run the following command:
mongosh admin --host "mongo-laboite-mongodb-0.mongo-laboite-mongodb-headless.laboite.svc.cluster.local:27017,mongo-laboite-mongodb-1.mongo-laboite-mongodb-headless.laboite.svc.clust
er.local:27017,mongo-laboite-mongodb-2.mongo-laboite-mongodb-headless.laboite.svc.cluster.local:27017,mongo-laboite-mongodb-3.mongo-laboite-mongodb-headless.laboite.svc.cluster.local:27
017,mongo-laboite-mongodb-4.mongo-laboite-mongodb-headless.laboite.svc.cluster.local:27017" --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD
pod/keycloak-0 condition met
--2022-11-22 17:14:01-- https://auth.mim-libre.eole3.dev/auth/realms/laboite
Résolution de auth.mim-libre.eole3.dev (auth.mim-libre.eole3.dev)… 51.158.59.107
Connexion à auth.mim-libre.eole3.dev (auth.mim-libre.eole3.dev)|51.158.59.107|:443… connecté.
requête HTTP transmise, en attente de la réponse… 503 Service Temporarily Unavailable
2022-11-22 17:14:01 erreur 503 : Service Temporarily Unavailable.
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /srv/mim-libre/laboite/kubeconfig-test-gitlab-laboite.yaml
NAME: laboite
LAST DEPLOYED: Tue Nov 22 17:14:01 2022
NAMESPACE: laboite
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
https://portail.mim-libre.eole3.dev/
Get token
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 321 100 190 100 131 3518 2425 --:--:-- --:--:-- --:--:-- 5944
parse error: Invalid numeric literal at line 1, column 7
Create user admapi
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>
Get UserId for admapi
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 190 100 190 0 0 3584 0 --:--:-- --:--:-- --:--:-- 3584
parse error: Invalid numeric literal at line 1, column 7
Reset admapi password
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>
Get realm-management client ID
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 190 100 190 0 0 3275 0 --:--:-- --:--:-- --:--:-- 3275
parse error: Invalid numeric literal at line 1, column 7
Display availables roles for realm-management
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 190 100 190 0 0 3725 0 --:--:-- --:--:-- --:--:-- 3800
parse error: Invalid numeric literal at line 1, column 7
Map role from realm managmement client to user admapi
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 190 100 190 0 0 4042 0 --:--:-- --:--:-- --:--:-- 4042
parse error: Invalid numeric literal at line 1, column 7
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>