This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: https://kubernetes.io/docs/reference/networking/ports-and-protocols/ | |
# Control plane Firewall rules | |
New-NetFirewallRule -DisplayName "Kubernetes API server" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 6443 | |
New-NetFirewallRule -DisplayName "etcd server client API" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 2379-2380 | |
New-NetFirewallRule -DisplayName "Kubelet API" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 10250 | |
New-NetFirewallRule -DisplayName "kube-scheduler" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 10259 | |
New-NetFirewallRule -DisplayName "kube-controller-manager" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 10257 | |
# Worker node Firewall rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "[Step 1] Disable and turn off SWAP" | |
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#before-you-begin | |
# 文件最後一行:Swap disabled. You **MUST** disable swap in order for the kubelet to work properly. | |
# K8s需要關閉swap | |
# 先手動關閉 | |
swapoff -a | |
# 將fstab裡的swap那一行註解 | |
sed -i '/swap/s/^/#/' /etc/fstab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 新主機 | |
winget install Microsoft.WindowsTerminal | |
winget install Microsoft.PowerShell | |
# 安裝 oh-my-posh | |
# https://ohmyposh.dev/docs/migrating,不要再使用 install-Module 來安裝 | |
# Install-Module oh-my-posh -Scope CurrentUser -Force | |
winget install JanDeDobbeleer.OhMyPosh | |
# 安裝 Terminal-Icons 模組 | |
Install-Module -Name Terminal-Icons -Repository PSGallery -Force | |
# 安裝最新版 PSReadLine 模組 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reference: https://blog.darkthread.net/blog/install-winterminal-wo-internet/ | |
Write-Host "Confirm https://github.com/microsoft/terminal/releases get latest version download Url" | |
Write-Host "Running PowerShell Core runtime" | |
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; | |
Invoke-WebRequest https://github.com/microsoft/terminal/releases/download/v1.12.10393.0/Microsoft.WindowsTerminal_1.12.10393.0_8wekyb3d8bbwe.msixbundle -OutFile Microsoft.WindowsTerminal.msixbundle | |
Rename-Item .\Microsoft.WindowsTerminal.msixbundle .\Microsoft.WindowsTerminal.zip | |
Expand-Archive .\Microsoft.WindowsTerminal.zip .\WTSource\. | |
# PowerShell not support .msix extract. | |
Expand-Archive .\WTSource\CascadiaPackage_1.12.10393.0_x64.msix .\WindowsTerminal\. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!pwsh | |
Import-Module Az.Accounts | |
Import-Module Az.Storage | |
Connect-AzAccount | |
$resourceGroup = "RG" | |
$storageAccountName = "AN" | |
$containerName = "CN" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# step 1, clean dangling image | |
docker rmi $(docker images -f "dangling=true" -q) | |
# step 2, search "before | since" images | |
## see "CREATED" | |
docker images --filter "since=baseimage" | |
# step 3, get IMAGE ID | |
docker images --filter "since=baseimage" -q | |
# step 3-1, Range | |
docker images --filter "since=baseimage" --filter "before=baseimage" | |
# step 4, delete "before | since" images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install-WindowsFeature -Name Web-Server | |
Install-WindowsFeature -Name Web-Http-Redirect, Web-Request-Monitor, Web-Http-Tracing, Web-Dyn-Compression, Web-Basic-Auth, Web-Windows-Auth, Web-Net-Ext45, Web-AppInit, Web-Asp-Net45, Web-WebSockets | |
Install-WindowsFeature -Name Web-Mgmt-Tools -IncludeAllSubFeature | |
cd \ | |
.\Windows\System32\inetsrv\InetMgr.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://aws.amazon.com/tw/premiumsupport/knowledge-center/s3-find-ip-address-ranges/ | |
https://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html#aws-ip-download | |
https://docs.aws.amazon.com/powershell/latest/reference/items/Get-AWSPublicIpAddressRange.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[string]$sourceDir | |
) | |
$ftpaddr = "example.com/upload/" | |
# option | |
$assemblies = ( | |
"System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL", | |
"System.IO, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
autoReload="true" | |
internalLogLevel="Info" | |
internalLogFile="c:\temp\internal-nlog.txt"> | |
<!-- 啟用 ASP.NET Core 排版呈現器 --> | |
<extensions> | |
<add assembly="NLog.Web.AspNetCore"/> |
NewerOlder