Top Kubectl commands you should know.

Get Contexts kubectl config get-contexts Get Pods kubectl get pods Get Pods' Performance kubectl top pods Get specific Pod Performance while true; do echo "=== $(date '+%Y-%m-%d %H:%M:%S') ===" >> pod_metrics.log; kubectl top pod >> pod_metrics.log; sleep 10; done

How to minify JSON in powershell?

 Recently, I had a requirement to minify json using powershell and I learnt that it is pretty simple and thought of adding it to my blog as well so that it can serve as future notes for me as well.

Here is my sample JSON

[
  {
    "name": "gaurav",
    "age": "32",
    "id": 1
  },
  {
    "name": "sunny",
    "age": "35",
    "id": 2
  }
]

Here is the powershell script:
$report = Get-Content './report.json' | Out-String
$minifiedJSON = (ConvertFrom-Json $report) | ConvertTo-Json -Compress;
Write-Host $minifiedJSON;
$minifiedJSON | Out-File -FilePath '.\minified.json'
Here is the output:
[{"name":"gaurav","age":"32","id":1},{"name":"sunny","age":"35","id":2}]