Skip to content

Instantly share code, notes, and snippets.

View tuxerrante's full-sized avatar
💭
Have you tried turning it off and on again?

Affinito Alessandro tuxerrante

💭
Have you tried turning it off and on again?
View GitHub Profile
@tuxerrante
tuxerrante / kubernetes_apis_with_curl.sh
Last active September 25, 2023 18:01 — forked from avoidik/curl.sh
Use curl instead of kubectl
#!/bin/bash
###
# download yq
#
set -ex
# https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-the-latest-release
latest_tag=$(curl -sL -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/mikefarah/yq/releases/latest |jq -r .tag_name)
@tuxerrante
tuxerrante / resource-quotas.sh
Created August 25, 2023 10:58
get all namespaces resourcequotas from kubernetes
# It could be improved to highlight quotas over 60%
# But that would require a major rework since quotas are already pre-formatted by kubectl by merging status hard/used numbers
kubectl get ns --no-headers -o=custom-columns=:.metadata.name |xargs -I {} bash -c "echo -e '\nNamespace {}'; kubectl get -n {} --no-headers resourcequotas" |sed -e "s|count/|\\n- |g" -e "s|cpu|\\n- cpu|g" -e "s|memory|\\n- memory|g" |sed "/^namespace-resource-quota/d" >/mnt/c/Users/alessandr
o.affinito/Downloads/dev-resource-quotas.log
"""
Namespace default
Namespace dev-xyz
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2204"
memory = 6144
cpus = 4
config.vm.provider :virtualbox do |v|
v.memory = memory

How to set up a testing environment for AppArmor operator with Microk8s in a new Virtualbox Ubuntu machine

# Totally Optional plugins
snap install starship

cat >> .bashrc <<'EOF'
eval "$(starship init bash)"
source <(helm completion bash)
source <(kubectl completion bash)
@tuxerrante
tuxerrante / kind-metrics-server.yaml
Last active June 13, 2022 17:52 — forked from hjacobs/kind-metrics-server.yaml
Metrics Server API deployment manifests for Kubernetes kind
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: system:aggregated-metrics-reader
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rules:
- apiGroups: ["metrics.k8s.io"]
# kubectl create secret -n prod generic prod-db --from-literal=db-user=root --from-literal=db-psw=paswrd --from-literal=db-host=prod-db --from-literal=app-color=red
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "2"
labels:
name: prod-web
name: prod-web
apiVersion: v1
kind: Pod
metadata:
labels:
name: staging-webapp
name: staging-webapp
namespace: staging
spec:
containers:
- env:
apiVersion: v1
kind: Pod
metadata:
labels:
name: staging-webapp
name: staging-webapp
namespace: staging
spec:
containers:
- env:
FROM ubuntu
COPY my_app/ /app
RUN set -x &&\
addgroup alex &&\
adduser --home /app --disabled-password --ingroup alex alex
USER alex
WORKDIR /app
#!/bin/bash
echo "HELLOOOOOOOOO WORLD"
echo