Skip to content

Instantly share code, notes, and snippets.

View legmac's full-sized avatar
👋
we did it

legmac

👋
we did it
View GitHub Profile
@legmac
legmac / k10 policy
Created August 16, 2022 10:57
acme policy
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-certmanager-solver
namespace: kasten
spec:
ingress:
- from:
- namespaceSelector: {}
podSelector:
@legmac
legmac / cmd
Last active August 1, 2022 15:53
k8s-disk snapshot
https://www.digitalocean.com/community/questions/how-do-you-clone-a-persistentvolumeclaim-in-kubernetes
https://kubernetes.io/docs/concepts/storage/volume-snapshots/
https://kubernetes.io/docs/concepts/storage/persistent-volumes/#volume-snapshot-and-restore-volume-from-snapshot-support
https://www.youtube.com/watch?v=bo21p0c7j9o
https://github.com/HoussemDellai/docker-kubernetes-course/tree/main/14_cluster_backup
@legmac
legmac / gist:8b88917ed3528bb5c5a6ea9264a80a7f
Created July 27, 2022 19:02
mongo Could not find member to sync from
https://dba.stackexchange.com/questions/154464/mongodb-replication-going-into-maintenance-mode-with-10333-other-maintenance-mo
// db.adminCommand({replSetMaintenance: 1})
[ReplicationExecutor] going into maintenance mode with 0 other maintenance mode tasks in progress
[ReplicationExecutor] transition to RECOVERING
// db.adminCommand({replSetMaintenance: 1})
[ReplicationExecutor] going into maintenance mode with 1 other maintenance mode tasks in progress
// db.adminCommand({replSetMaintenance: 0})
[ReplicationExecutor] leaving maintenance mode (1 other maintenance mode tasks ongoing)
kubectl delete sts sts --cascade=false # keep pods running
kubectl -f sts.yaml create
kubectl patch pvc sts-sts-0 -p '{ "spec": { "resources": { "requests": { "storage": "15Gi" }}}}'
https://itnext.io/k8s-raise-statefulset-volume-size-with-low-impact-33fe1e2576f6
@legmac
legmac / HelloResource.java
Created July 19, 2022 07:43
qurkus respons
package problem;
import com.tietoevry.quarkus.resteasy.problem.HttpProblem;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
@Path("/hello")
public class HelloResource {
@legmac
legmac / memory.sh
Created April 1, 2022 10:44
monitoring script
#echo $totalmem
totalmempro=$(printf "%.0f\n" $totalmem)
echo Total Memory in Gb = $totalmempro
memusage=$(free | awk '/Mem/{printf("RAM Usage: %.2f%\n"), $3/$2*100}' | awk '{print $3}')
echo Memory Usage in % = $memusage
memfree=$(free -mh | sed -n 2p | awk '{print $4}' | sed 's/\G//g')
echo Memory free in Gb = $memfree
@legmac
legmac / LB-controller.cmd
Last active March 31, 2022 13:40
LoadBalacerDO
bitnami/nginx-ingress-controller
https://github.com/bitnami/charts/tree/master/bitnami/nginx-ingress-controller
helm install nginx-ingress stable/nginx-ingress --set controller.publishService.enabled=true
#https://bobcares.com/blog/nginx-ingress-on-digitalocean-kubernetes-using-helm/
kubectl describe -A ValidatingWebhookConfiguration ingress-nginx-admission > ValidatingWebhookConfiguration.yaml
kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
@legmac
legmac / tall only config
Created March 17, 2022 10:20
tar_php_html
//https://stackoverflow.com/questions/18731603/how-to-tar-certain-file-types-in-all-subdirectories
find ./someDir -name "*.php" -o -name "*.html" | tar -cf my_archive -T -
Easy with zsh:
tar cvzf foo.tar.gz **/*.(php|html)
jenkins:
systemMessage: "Welcome to Jenkins "
jobs:
- script: >
pipelineJob('configuration-as-code') {}
unclassified:
location:
url: "http://localhost:8080/"