Skip to content

Instantly share code, notes, and snippets.

View kun432's full-sized avatar

Kuniaki Shimizu kun432

View GitHub Profile
@kun432
kun432 / index.md
Last active January 19, 2022 00:07
今更fail2ban

centos7で確認

$ sudo yum install -y epel-release
$ sudo yum install -y fail2ban

ディレクトリ構成

@kun432
kun432 / sample.tf
Created October 26, 2021 17:44
terraformでbgp site2site vpn
resource "aws_customer_gateway" "cgw-main" {
bgp_asn = 65000
ip_address = var.cgw1
type = "ipsec.1"
tags = {
Name = "cgw-main"
}
}
@kun432
kun432 / gist:2f3374ce6038b5a6d468cdde32007db3
Created October 18, 2021 03:08
cloud optix のcloudformation stackの実行に必要な権限
"elasticfilesystem:DescribeMountTargetSecurityGroups",
"elasticfilesystem:DescribeMountTargets",
"sns:ListSubscriptions",
"s3:GetAccountPublicAccessBlock",
"ce:GetCostAndUsage",
"ce:GetCostForecast",
"ce:GetUsageForecast",
"eks:List*",
"detective:ListGraphs",
"ec2:SearchTransitGatewayRoutes",
@kun432
kun432 / cfn-onboarding-mini.yaml
Created October 15, 2021 06:40
cloud optixのcloudformation stackのyaml
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Template to create AWS resources for onboarding an account with Sophos Optix
# ExternalId and CustomerId come from the Sophos Optix UI.
Parameters:
ExternalId:
Type: String
@kun432
kun432 / index.md
Last active October 15, 2021 03:58
service

トポロジを意識したservice転送

  • Topology-aware service routing
    • クラスタがリージョンやAZにまたがっていてもserviceは意識せずに転送する
    • またがるとレイテンシーやパフォーマンスの低下
    • ノード数が多いと起きやすい
  • externalTrafficPolicy: Localでリスクは下げれるが・・・
    • ClusterIPでは不可
    • 同一ノード内でしか転送できない、同一ノード内にpodがいなければタイムアウト
  • Topology-aware service routingにより回避できる
@kun432
kun432 / vagrant-ctrl.sh
Created October 2, 2021 18:50
virtualbox環境でvagrant upとかを並列で行う
#!/bin/bash
parallel=3
subcmds="$@"
vagrant status --machine-readable | \
perl -wnlaF"," -e 'print $F[1] if $F[2] =~ /metadata/;' | \
xargs -P${parallel} -I {} vagrant $subcmds {}
@kun432
kun432 / resize.sh
Created October 2, 2021 05:58
cloud9のディスクサイズを変更するシェル
#!/bin/bash
# Specify the desired volume size in GiB as a command line argument. If not specified, default to 20 GiB.
SIZE=${1:-20}
# Get the ID of the environment host Amazon EC2 instance.
INSTANCEID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
# Get the ID of the Amazon EBS volume associated with the instance.
VOLUMEID=$(aws ec2 describe-instances \
@kun432
kun432 / bootcamp-service.yaml
Created September 20, 2021 12:34
LoadBalancer Serviceのサンプル
apiVersion: v1
kind: Service
metadata:
name: bootcamp-service
spec:
type: LoadBalancer
ports:
- name: "http-port"
protocol: "TCP"
port: 8888
@kun432
kun432 / sample-deployment.yaml
Created September 20, 2021 11:57
deploymentのサンプル
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: bootcamp
name: bootcamp-deployment
spec:
replicas: 3
selector:
matchLabels:
@kun432
kun432 / quagga.md
Last active September 18, 2021 19:27
quagga on ubuntu bionic
1台目を構築s
Vagrantfile
```ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"