Skip to content

Instantly share code, notes, and snippets.

View phivid's full-sized avatar

Vidal Philippe phivid

View GitHub Profile
terraform apply
random_id.log_analytics_workspace_name_suffix: Refreshing state... [id=kU80vOkuaOM]
random_password.sp_pwd: Refreshing state... [id=none]
azuread_application.app: Refreshing state... [id=813e0397-6ae6-4405-8959-47210285a032]
azuread_service_principal.cluster_sp: Refreshing state... [id=02f222bf-5235-45d0-a554-3e0a415e8124]
azuread_service_principal_password.sp_pwd: Refreshing state... [id=02f222bf-5235-45d0-a554-3e0a415e8124/password/dafeb077-5d88-6e81-4143-9852ab8d6e4b]
data.azurerm_subscription.current: Refreshing state... [id=/subscriptions/[MASKED]]
data.azurerm_public_ip.public_ip_in: Refreshing state... [id=/subscriptions/[MASKED]/resourceGroups/rg-aks-dev/providers/Microsoft.Network/publicIPAddresses/public-ip-in-dev]
data.azurerm_resource_group.aks_cluster_rg: Refreshing state... [id=/subscriptions/[MASKED]/resourceGroups/rg-aks-dev]
data.azurerm_public_ip.public_ip_out: Refreshing state... [id=/subscriptions/[MASKED]/resourceGroups/rg-aks-dev/providers/Microsoft.Network/publicIPAddres
#!/bin/bash
#set -e
# Script to restore InfluxDB data from first full backup found before $RESTORE_DATE until $RESTORE_DATE.
# Pre-requisites:
# RESTORE_DATE : Date is set in format YYYYMMDDTHHMMSSZ (UTC time). Can be "latest".
# AZ_ENV : Environment to work in.
# DATABASES : Databases to import.
# TO_DATABASES : Databases to import to new databases.
# TENANT_ID : Tenant ID to work with.
provider "aws" {
version = "~> 2.0"
region = "eu-west-1"
ignore_tag_prefixes = ["kubernetes.io"]
}
data "aws_ssm_parameter" "alb_dns" {
name = "/infra/${var.application}/alb_dns"
}
data "aws_ssm_parameter" "r53_zone_id" {
name = "/infra/base/r53_zone_id"
}
resource "aws_route53_record" "app" {
zone_id = data.aws_ssm_parameter.r53_zone_id.value
aws --profile ${AWS_ACCOUNT} --region eu-west-1 ssm put-parameter --name "/infra/${TF_VAR_application}/alb_dns" --type "String" --value "`./kubectl get ingress/${TF_VAR_application}-ingress -n ${TF_VAR_application} -o jsonpath --template='{.status.loadBalancer.ingress[0].hostname}'`" --overwrite
# Création du Namespace
---
apiVersion: v1
kind: Namespace
metadata:
name: "2048-game"
# Création du Rôle
---
kind: RoleBinding
resource "aws_iam_policy" "eks_update_kubeconfig"
// Permission nécessaire pour utiliser la commande `aws eks update-kubeconfig`.
resource "aws_iam_role" "eks_deployer"
// Rôle qui sera bindé sur un `Role` K8S scopé au namespace de l'application.
resource "aws_iam_role_policy_attachment" "eks_readonly"
// Attachement de la police sur le rôle.
➜ ~ kubectl -n 2048-game describe ingress/2048-ingress
Name: 2048-ingress
Namespace: 2048-game
Address: a261edff-2048game-2048ingr-6fa0-xxxxxxxxxxx.eu-west-1.elb.amazonaws.com
Default backend: default-http-backend:80 (<none>)
Rules:
Host Path Backends
---- ---- --------
*
/* ssl-redirect:use-annotation (<none>)
~ kubectl -n kube-system describe configmap/aws-auth
Name: aws-auth
Namespace: kube-system
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","data":{"mapRoles":"- rolearn: arn:aws:iam::<aws_account_id>:role/eks-node-group-example\n username: system:node:{{EC2Priv...
Data
====
mapRoles:
➜ ~ kubectl logs deployment/alb-ingress-controller -n kube-system
-------------------------------------------------------------------------------
AWS ALB Ingress controller
Release: v1.1.3
Build: git-6101b02d
Repository: https://github.com/kubernetes-sigs/aws-alb-ingress-controller.git
-------------------------------------------------------------------------------
W1202 21:25:18.422337 1 client_config.go:549] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I1202 21:25:18.479497 1 controller.go:121] kubebuilder/controller "level"=0 "msg"="Starting EventSource" "controller"="alb-ingress-controller" "source"={"Type":{"metadata":{"creationTimestamp":null}}}