docker run -v /var/run/docker.sock:/var/run/docker.sock -v /root/trivy-cache:/root/.cache/ aquasec/trivy:0.18.3 image -f json nginx
https://aquasecurity.github.io/trivy/v0.18.3/examples/report/
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /root/trivy-cache:/root/.cache/ aquasec/trivy:0.18.3 image -f json nginx
https://aquasecurity.github.io/trivy/v0.18.3/examples/report/
curl -s -I -HHost:httpbin.example.com "http://$INGRESS_HOST:$INGRESS_PORT/status/200"
curl -s -H 'X-Canary: always' -HHost:app.example.com "http://192.168.0.184:30988/"
while(true)
do curl -HHost:app.example.com "http://192.168.0.184:30988/"
sleep 0.5
done
https://istio.io/latest/docs/tasks/traffic-management/ingress/ingress-control/
kubectl api-resources
# look for which apiservice is giving error
kubectl get apiservice
# look for which False and MissingEndpoints
kubectl delete apiservice <service-name>
kubectl api-resources
# get CRD related to api-resources
kubectl get crds | grep cilium
kubectl delete crd ciliumnodes.cilium.io
https://github.com/helm/helm/issues/6361#issuecomment-538220109
NAMESPACE=your_namespace
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
https://github.com/helm/helm/issues/6361
kubectl -n rook-ceph patch cephclusters.ceph.rook.io rook-ceph -p '{"metadata":{"finalizers": []}}' --type=merge
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n rook-ceph
a='hello world
hello world
hello world
hello world
hello world ad a a t t hello'
n=0
> result.txt
for word in $a
do
wcount=$(echo $a| grep -o $word | wc -l)
echo "$word : $wcount" >> result.txt
done
cat result.txt | uniq
yum install expect tcl tcllib
dd if=/dev/sda | ssh USERNAME@IP_ADDR dd of=sda.iso
xfs_undelete sda.iso
More :
https://github.com/ianka/xfs_undelete
https://unix.stackexchange.com/questions/132797/how-to-dd-a-remote-disk-using-ssh-on-local-machine-and-save-to-a-local-disk
ssh-keygen -b 2048 -t rsa -f /tmp/sshkey -q -N ""
ssh -o StrictHostKeyChecking=no -i /tmp/sshkey jenkins@192.168.0.183 << EOF
ls -ltr
hostname
EOF
Note : If we creates eks cluster from UI it’s creates with different user and gives error when we do kubectl get pod
aws eks get-token --cluster-name eks1
aws eks update-kubeconfig --name eks1
aws sts get-caller-identity
aws sts assume-role --role-arn "arn:aws:iam::1111111111:role/role-name" --role-session-name "tests3"
aws --profile=default eks update-kubeconfig --name eks1
aws eks create-cluster \
--region ap-south-1 \
--name eks1 \
--kubernetes-version 1.20 \
--role-arn arn:aws:iam::account_number:role/eks1-clst \
--resources-vpc-config subnetIds=subnet-093a2ddfcb7bc30b1,subnet-0475d9e26dfdc9d00,subnet-0274975b4af3513ee
aws eks describe-cluster \
--region ap-south-1 \
--name eks1 \
--query "cluster.status"
https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html
always check the minimum version of aws cli for eks
https://aws.amazon.com/premiumsupport/knowledge-center/eks-api-server-unauthorized-error/
pipeline {
agent {label 'master'}
parameters {
string(name: 'string1', defaultValue: 's1', description: 's1')
choice(name: 'CHOICES', choices: ['one', 'two', 'three'], description: 'chose')
password(name: 'password', defaultValue: 'SECRET', description: 'password')
}
stages{
stage('one'){
steps{
sh "echo abc > abc.txt"
stash includes: 'abc.txt', name: 'abc'
sh "rm -rf abc.txt"
}
}
stage('two'){
steps{
unstash 'abc'
sh "cat abc.txt"
}
}
}
}
pipeline {
agent {label 'master'}
stages{
stage('one'){
steps{
sh "echo abc > abc.txt"
stash includes: 'abc.txt', name: 'abc'
sh "rm -rf abc.txt"
}
}
stage('two'){
steps{
unstash 'abc'
sh "cat abc.txt"
}
}
}
}
Open port using NC:
nc 8888
Listen port:
nc localhost 8888
Send packet using bash:
echo -n "hello" >/dev/tcp/localhost/8888