Skip to content

Instantly share code, notes, and snippets.

View dasgoll's full-sized avatar

dasgoll

  • Amman, Jordan
View GitHub Profile
@dasgoll
dasgoll / gist:ec6de3d26355809837076017311e42ea
Created October 27, 2022 08:21
kubectl patch change service type from nodeport to clusterip
kubectl patch svc dbp-transaction-microservice --type='json' -p '[{"op":"replace","path":"/spec/type","value":"ClusterIP"}]'
kubectl patch svc dbp-transaction-microservice -p '{"spec": {"type": "ClusterIP"}}'
@dasgoll
dasgoll / gist:dca01da5f17f452200e883eca3097cfd
Last active October 28, 2022 01:55
Ingress resources are not getting deleted even though the alb ingress controller deployment is deleted
Reference: [https://github.com/kubernetes-sigs/aws-load-balancer-controller/issues/1629#issuecomment-726872539]
I deleted the AWS Load Balancer Controller (alb) before deleting the ingress, and I couldn't delete the ingress.
Solution:
-> % k get ingress echoserver -o yaml | grep -A 5 finalizers
finalizers:
- group.ingress.k8s.aws/mygroup
generation: 19
name: echoserver
@dasgoll
dasgoll / gist:81048813f0348d318f926c9092173cc3
Created October 21, 2022 09:57
Concatenate fields in json using jq
docker image ls --format '{{json .}}' | jq '.Repository + ":" + .Tag'
@dasgoll
dasgoll / gist:7aed115c8f617d244c8d059acaa6ad39
Last active October 21, 2022 09:47
SSH to ec2 instance using EC2 Instance Connect
aws ec2-instance-connect send-ssh-public-key --instance-id i-XXYYZZ --availability-zone eu-central-1c --instance-os-user ec2-user --ssh-public-key file:///home/foo/.ssh/id_rsa.pub --profile devops
ssh ec2-user@PUBLIC_IP
OR
pip install ec2instanceconnectcli
mssh ec2-user@i-XXYYZZ --profile devops
###
sudo pip3 install ec2instanceconnectcli
mssh ec2-user@i-XXYYZZZ --profile devops
msftp ec2-user@i-XXYYZZZ:/etc/fstab . --profile devops
kind: Service
apiVersion: v1
metadata:
name: mi-service
spec:
type: ExternalName
externalName: example.com
@dasgoll
dasgoll / gist:90ca56106bf81d3791186dc91a29280a
Last active October 11, 2022 17:54
Search All of Your Git History commit
## reference: https://www.youtube.com/watch?v=BaBKBy2vHmM
git log -S accountSubType
git log -S accountSubType -p
## search all branches
git log -S accountSubType -p --all
## search recursively in .py files
@dasgoll
dasgoll / gist:516507941a6e3e13c36ebf3b3732de58
Created October 6, 2022 09:20
jq return json with variable
jq -n --arg boss "$USER" '{"boss":$boss}'
@dasgoll
dasgoll / gist:2cef3f6cf73507b65f550abc67ee55f0
Last active April 14, 2022 07:56
Using ssh-copy-id to copy public key to server
ssh [email protected] sh -c "'cat >> .ssh/authorized_keys'" < /tmp/sami.pub
@dasgoll
dasgoll / rsync.sh
Created March 11, 2022 08:17
Rsync from one server to another
/boot/
/etc/modules
/etc/fstab
/etc/mtab
/etc/netplan/
/etc/network/
/etc/sysconfig/network-scripts/
/lib/modules
lost+found/
/sys/