For every command you enter with kubectl (if you have enough permissions) you can alternatively specify the namespace --namespace=default
<service>.<namespace>.svc.cluster.local
kubectl get nodes -o json | grep "\"address\": \"" | uniq | sort | awk '{print $2}'
kubectl scale --replicas=3 deployment <deployment>
kubectl create secret docker-registry <secret-name> \
--docker-server=<your-registry-server> \
--docker-username=<your-name> \
--docker-password=<your-pword> \
--docker-email=<your-email>
kubectl create secret tls <secret-name> \
--cert <cert.file> \
--key <key.file>
kubectl get secret <secret-name> (optional '-o' or '--output=yaml')
kubectl create -f secrets.yml
kubectl logs <podname> (optional '-p' will show logs of previously crashed container and -f will report a livelog)
kubectl get nodes --show-labels
kubectl label nodes <node-name> <label-key>=<label-value>
kubectl label nodes <node-name> <label-key>=<label-value> ---overwrite
kubectl label node <nodename> <labelname>-
Command | Description |
---|---|
key=value | key is set to value |
key!=value | key is not set to value |
key in (value1, value2) | key is one of value1 or value2 |
key notin (value1, value2) | key is not of value1 or value2 |
key | key is set |
!key | key is not set |
key in (value1, value2) | are neat |
echo -n 'whale' | base64
Output => 'd2hhbGU='
echo -n 'd2hhbGU=' | base64 -d
Output => 'whale'
kubectl proxy
or with a different port (default 8001) --port=9090
http://127.0.0.1:8001/api/v1/namespaces/<namespace>/services/<service><:port-name>/proxy/
kubectl config use-context <cluster_context>
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: <ingress-name>
annotations:
kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/rewrite-target: "/"
ingress.kubernetes.io/configuration-snippet: |
if ($http_x_forwarded_proto != 'https') {
return 301 https://$host$request_uri;
}
Ingress Config NGINX https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/annotations.md
kubectl cluster-info
or kubectl cluster-info dump
https://www.mobilise.cloud/post/15-kubernetes-security-best-practice-to-secure-your-cluster
0x0f13858a75d4eE784B68499F3d8E0ca5CA9E26Be
Usdt donasi sir..