Affichage des articles dont le libellé est Cloud. Afficher tous les articles
Affichage des articles dont le libellé est Cloud. Afficher tous les articles

vendredi 12 juin 2020

Google Cloud Tweak Ingress and Healthcheck

Now  you have everything is on the GKE cluster, differents namespaces, deployments, products and devs.

As always locally it works on the machine but once deployed you get the terrible HTTP/502 the new Blue Screen of Death.

Why ?
Then you troubleshoot ?
    You got 502 after a 30s timeout ?
    You log to the logs /index.html and get HTTP/404 !

What's wrong ? You look to ingress configuration Nginx container, ... then you realize each products have their specificites some have no /index.html, just a response to /, other need a longer timeout to upload or process stuff and so on.

Cloud brings another layer of complexity, for this reason sometimes you need to tweak backend-services and health-checks.

By default backend-services (loadbalancer) have a 30s timeout default.
You can list them and find you backend-services rules
gcloud compute backend-services list

Sometimes it's easier from the console to get the loadbalancer then the backend service you need.
Then you can check with describe
gcloud compute backend-services describe k8s-be-30080--9747qarggg396bf0 --global

Then you can update your timeout or any other settings
gcloud compute backend-services update k8s-be-30080--9747qarggg396bf0 --global --timeout=600

Take a coffee to give time to apply and Bingo your HTTP/502 disappear.
Well this one.

You can also tweak healthcheck
From the console find the healthcheck you need.
You can also list them 
gcloud compute health-checks list --global

Then describe to control
gcloud compute health-checks describe k8s-be-30569--9747df6bftswwq5c396bf0

Update the healthcheck to your needs
gcloud compute health-checks update http k8s-be-30569--9747df6bftswwq5c396bf0 --request-path=/

Now you managed a second HTTP/502 error.
Congratulations
What's next ?

dimanche 13 novembre 2016

Envoyer des emails depuis instance Google Cloud Platform avec Mailgun

Premiers pas sur Google Cloud Platform, GCP 
Google bloque tous les emails sortant passant par le port TCP/25 (SMTP) et invite a utiliser un tiers :
  • SendGrid, Mailgun, ou Mailjet
  • Google Apps domain
  • Serveur email prive 
Personnellement j'ai choisi Mailgun : gratuit - 30 000 emails envoyé par mois. Il suffit d'un compte Google.

Pour utiliser Mailgun, il faut realiser deux configuration comme pre-requis.

Configurer Postfix

Configurer Postfix de la façon suivante :

relayhost = [smtp.mailgun.org]:2525
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtp_tls_note_starttls_offer = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:postmaster@mondomain.com:monpassword
smtp_sasl_security_options = noanonymous
smtp_sasl_auth_enable = yes

Le nom d'utilisateur et son mot de passe son disponible sur le Dashboard de Mailgun




 

Valider son domaine : configurer son DNS

Mailgun a besoin de valider le domaine pour envoyer et même recevoir les emails, pour valider le domaine, créer les enregistrements suivants :

  • TXT     “v=spf1 include:mailgun.org ~all”     SPF (Required)
  • TXT     copier le DKIM (disponible sur le dashboard)
  • CNAME     “mailgun.org”     Tracking (pour effectuer un suivi, optionel)
Par exemple :
  • Name : @, type:  TXT valeur : "v=spf1 include:mailgun.org ~all"
  • Name : mx._domainkey, type : TXT, valeur : "k=rsa; p=...MIGfMA0GCSqGS"
Attendre la réplication DNS et le domaine doit passer comme "Valider, en vert"

Une fois réaliser et valider ces deux pre-requis, le compte Mailgun est fonctionnel et permet d'envoyer des emails depuis votre instance Google Cloud.
Enfin Mailgun permet également de recevoir des emails, de réaliser un suivi, de créer des campagnes et propose de nombreuses API.
De facon, on realise ces premiers pas dans le Cloud.