Skip to content

Instantly share code, notes, and snippets.

View sujaypillai's full-sized avatar
🐳
Getting contained!!!

Sujay Pillai sujaypillai

🐳
Getting contained!!!
View GitHub Profile
# https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-windows.html
$dlurl = "https://awscli.amazonaws.com/AWSCLIV2.msi"
$installerPath = Join-Path $env:TEMP (Split-Path $dlurl -Leaf)
Invoke-WebRequest $dlurl -OutFile $installerPath
Start-Process -FilePath msiexec -Args "/i $installerPath /passive" -Verb RunAs -Wait
Remove-Item $installerPath
$env:Path += ";C:\Program Files\Amazon\AWSCLI\bin"
@sujaypillai
sujaypillai / gist:51e2351f13b7e3067d2848a42d0434f0
Created May 3, 2021 22:55
ResourceGraph query with hidden resource type
resources|where (resourceGroup =~ ('rg-lab-Rodion_Esartiia'))|extend typeDisplayName=case(
type =~ 'microsoft.insights/components','Application Insights',
type =~ 'microsoft.insights/privatelinkscopes','Azure Monitor Private Link Scope',
type =~ 'microsoft.insights/webtests','Availability test',
type =~ 'microsoft.insights/workbooks','Azure Workbook',
type =~ 'microsoft.insights/workbooktemplates','Azure Workbook Template',
type =~ 'microsoft.appplatform/spring','Azure Spring Cloud',
type =~ 'microsoft.appplatform/tanzu','Azure Spring Cloud',
type =~ 'microsoft.cache/redisenterprise','Redis Enterprise',
type =~ 'microsoft.cache/redisenterprise/databases','Cache',
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecs:ListAccountSettings",
"ec2:DescribeVpcs",
"ec2:DescribeSubnets",
"cloudformation:CreateStack",
version: '3.7'
services:
website:
image: klakegg/hugo:0.63.2
environment:
HUGO_ENV: production
HUGO_BASEURL: https://sujaypillai.dev
command: server --baseURL https://sujaypillai.dev --appendPort=false
ports:
version: '3.7'
services:
traefik:
image: traefik:1.7.13
ports:
- target: 80
published: 80
mode: host
- target: 443
kind build node-image --image=master
Starting to build Kubernetes
+++ [0316 01:00:27] Verifying Prerequisites....
+++ [0316 01:00:27] Using Docker for MacOS
+++ [0316 01:00:29] Building Docker image kube-build:build-e833071e21-5-v1.13.8-1
+++ [0316 01:00:31] Syncing sources to container
+++ [0316 01:00:34] Output from this container will be rsynced out upon completion. Set KUBE_RUN_COPY_OUTPUT=n to disable.
+++ [0316 01:00:34] Running build command...
warning: ignoring symlink /go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes
go: warning: "k8s.io/kubernetes/vendor/github.com/go-bindata/go-bindata/..." matched no packages
variable:
region: "southeastasia"
ucp_password:
type: prompt
provider:
azurerm:
region: ${region}
cluster:
@sujaypillai
sujaypillai / fluentd.conf
Created May 21, 2019 16:09 — forked from jsturtevant/fluentd.conf
simple fluentd conf
<source>
@type forward
</source>
<match test.**>
@type stdout
</match>

Windows Containers Logging

With Windows Containers, as with any application, you will need to consider your logging strategy. In the containers world it is generally accepted to log to STDOUT/STDERR (standard out and standard error). As you scale up your services you will need to aggregate and store these logs for analysis and debugging later on. There exist many back end systems to aggregate logs and help with analysis, in Azure you have Log Analytics and Application Insights.

There are two general strategies for configuring your containers to send logs to a backend logging system containers:

  • In container logging - Your application is responsible for sending the logs directly to the backend system. This can also be [configured via sidecar].
  • Host level logging - You application is configured for sending logs to a log collection agent on the system. The logging agent will
@sujaypillai
sujaypillai / clean-users.sh
Created April 22, 2019 06:26
Clear users synced from AD in UCP
#!/bin/bash
delete_users() {
mapfile -t < <(curl -s -X GET "https://${HOST}:${PORT}/accounts/?filter=non-admins&limit=1024" -H "accept: application/json" -H "Authorization: Bearer ${AUTHTOKEN}"| jq .accounts[].name)
len=${#MAPFILE[@]}
echo "Fetched $len users for deleting....."
for ((i=0;i<$len;i++)); do
echo "$i user ::"
userName=$(echo ${MAPFILE[$i]}|sed 's/"//g');
echo $(curl -s -X DELETE "https://${HOST}:${PORT}/accounts/$userName" -H "accept: application/json" -H "Authorization: Bearer ${AUTHTOKEN}");
done