bookmark_bordercurl

sudo apt-get install curl
​
-d, --data: <data> Send specified data in POST request. 
-H, --header: <header> Headers to supply with request. 
-X, --request: The request method to use. ex) GET, POST

[GET]
curl -d "key1=value1&key2=value2" \
-H "Content-Type: application/x-www-form-urlencoded" \
-X GET http://localhost:8000/data
​
[POST]
​
[URL]
curl -d "key1=value1&key2=value2" \
-H "Content-Type: application/x-www-form-urlencoded" \
-X POST http://localhost:8000/data

[JSON]
curl -d '{"key1":"value1", "key2":"value2"}' \
-H "Content-Type: application/json" \
-X POST http://localhost:8000/data

bookmark_border[mysql] reference

delete from network_flow; delete from discovered_policy;

select count(*) from discovered_policy where rule like '%CIDR%';
select count(*) from discovered_policy where status="latest";
select count(*) from discovered_policy where status="outdated";
select * from discovered_policy where status="outdated"\G
select * from discovered_policy where name="autopol-egress-vxitcdpetakyjtx"\G
select count(*) from discovered_policy where (rule not like '%FQDN%' and rule not like '%CIDR%');
select count(*) from network_flow;

desc network_flow;

select * from network_flow limit 1\G
select * from discovered_policy WHERE name="autopol-egress-mvoiglopbuopedk"\G
select * from discovered_policy WHERE name="autopol-egress-hgcmdflittqwlue"\G
select * from network_flow WHERE name=autopol-egress-hgcmdflittqwlue\G
select * from discovered_policy limit 1\G

SELECT * FROM network_flow ORDER BY id DESC LIMIT 1\G
SELECT time FROM network_flow ORDER BY id DESC\G
SELECT count(*) FROM network_flow where time >= 0 and time < 1607601663\G

bookmark_border[k8s] kubectl port-forward

The port-forward command, Forwards one (or more) local ports to a pod.

This command is very useful for example in blue/green deployments where you would want to troubleshoot a misbehaving pod.

To take things even further, you could even execute some preliminary tests to the pods you feel could be more error-prone right inside your CI/CD pipeline in Jenkins by using multiple conditions, declarative pipeline.

Usage examples:

Listen on port 8888 locally, forwarding to 5000 in the pod

kubectl port-forward pod/mypod 8888:5000

Listen on port 8888 on all addresses, forwarding to 5000 in the pod

kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000

Listen on a random port locally, forwarding to 5000 in the pod

kubectl port-forward pod/mypod :5000

Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod

kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000

Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod

kubectl port-forward pod/mypod 5000 6000

Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment

kubectl port-forward deployment/mydeployment 5000 6000

Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the service

kubectl port-forward service/myservice 5000 6000