
I love to grease knots and bolts of SDLC, nurture the underlying infra, rightly automate, monitor systems and enable the dev teams to achieve more with less.
Search for a command to run...

I love to grease knots and bolts of SDLC, nurture the underlying infra, rightly automate, monitor systems and enable the dev teams to achieve more with less.
No comments yet. Be the first to comment.
Command Cheat sheet https://helm.sh/docs/intro/cheatsheet/ Add/Search/Install/Uninstall repo helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update bitnami helm repo list helm install wordpress bitnami/wordpress helm list helm sta...

https://kops.sigs.k8s.io/getting_started/aws/ Pre-requisite DOMAIN=kops.balmanrawat.com.np aws route53 create-hosted-zone \ --name ${DOMAIN} \ --caller-reference kops-expriment ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --ou...

Containers have become the default way to package, ship, and run modern applications. They make deployments repeatable, portable, and scalable. But containers are not magic security boxes. A container

Details: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/ Pre-requisite A compatible Linux host. Verify the MAC address and product_uuid are unique for every node. Kubernetes uses these values to uniquely ident...

Docs Link1 Link2 Install Session Manger Plugin AWS SSM Proxy. Optional Start basic ssh connection aws ssm start-session \ --target i-askfsa8asld Port Forwarding aws ssm start-session \ --target i-00e68c055d1c0b087 \ --document-na...

kubectl get pods
kubectl get pods --show-labels
kubectl run nginx --image=nginx
k run nginx --image=nginx --labels app=nginx
kubectl describe pod nginx
kubectl delete pod nginx
kubectl delete pod -lapp=nginx
k delete pod nginx --force --grace-period=0
k delete pod nginx --now #similar to --grace-period=1
kubectl run nginx --image=nginx --dry-run=client -o yaml > nginx-pod.yaml
kubectl edit pod nginx
kubectl get pods -o json
k run static-busybox --image=busybox -- sh -c "sleep 1000"
k run busybox --image=busybox --restart=Never -- sh -c "echo sleeping.... && sleep 5"
kubectl run busybox-pod --image=busybox --restart=Never --command -- /bin/sh -c "echo 'sleeping...'; sleep 5"
kubectl replace nginx --force -f nginx.yaml
You cannot edit pod spec other than
- spec.containers[*].image
- spec.initContainers[*].image
- spec.activeDeadlineSeconds
- spec.tolerations
k get rs nginx
kubectl describe rs nginx
k explain rs nginx
k edit rs nginx
k scale rs nginx --replicas 2
k scale --replicas 2 -f manifest.yaml
k delete rs nginx
k delete rs nginx --force --grace-period=0
k get deploy
k create deploy nginx --image=nginx --replicas=3
# With Deployments you can easily edit any field/property of the POD template. Since the pod template is a child of the deployment specification, since it deletes the pod and recreats it
k get ns
k create ns myns
k get pods -n myns
k run nginx --image=nginx -n myns
k get pods -A
k get pods --all-namespaces
<service-name>.<namespace>.svc.<cluster-endpoint>
k get svc
k get svc --show-labels
k describe svc
k get ep
k run nginx --image=nginx --expose --port 8080
k expose pod nginx-pod --name nginx-service --port 80
k expose deployment webapp --type NodePort --port 30082 --target-port 8080
#port range => (30000 - 32767)
kube-proxy --proxy-mode iptables/ipvs/userspace #default is iptables
kube-api-server --service-cluster-ip-range ## is the option to specify the ip range of the service
iptables -L -t nat | grep <service-name> to list the iptables rules
tail -f /var/log/kube-proxy.log
before k8s 1.12 DNS was called kube-dns and now the recommended is core-dns
configuration file for core-dns can be found in /etc/coredns/corefile
Service FQDN: <service-name>.<namespace>.svc.<cluster-endpoint>
By default pod DNS is disabled.
FQDN: <pod-ip>.<namespace>.pod.<cluster-endpoint>
core-dns is accessible using the service with name kube-dns
pod's DNS configurations are automatically set by the Kubernetes using kubelet process. kubelet gets the cluster domain and the DNS IP using its config.
Sample Core File
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf {
max_concurrent 1000
}
cache 30
loop
reload
loadbalance
}
## core file
kubectl get cm coredns -n kube-system -o yaml | less
##
k get nodes
k get nodes -o jsonpath='{.items[*].status.nodeInfo.osImage}'
k taint node node01 color=blue:NoExecute
k taint node node01 color=blue:NoSchedule
k taint node node01 color=blue:PreferNoSchedule
k taint node controlplane node-role.kubernetes.io/control-plane:NoSchedule-
k label node node01 color=blue
kubectl label node node01 color-
#see the list of interfaces
ip link
#see ip address
ip addr
ip addr show
## add ip address
ip addr add 192.168.1.5/24 dev eth0
# list the routes
ip route
#ip route add <network-addr> via <gateway-ip>
ip route add 192.168.1.0/24 via 192.168.2.1
#if gateway is directly linked with interface then you can
ip route add 192.168.1.0/24 dev eth0
#verify if the forward is enabled or not. if 0 disabled/if 1 enabled
cat /proc/sys/net/ipv4/ip_forward
#Modify /etc/systcl.conf to forward the request from one interface to others
## modify /etc/nsswitch.conf to update the priority of the dns server
cat /etc/nsswitch.conf
#you can add extra nameservers in resolv.conf by adding
nameserver 8.8.8.8
#you can append domain alias as well by using
search mycompany.com, prod.mycompany.com