Jbn1233

$ kubectl get svc echo3-service 
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
echo3-service ClusterIP 10.96.179.217 <none> 80/TCP 5d17h
$ kubectl get endpoints echo3-service
NAME ENDPOINTS AGE
echo3-service 10.169.198.255:8080,10.169.4.216:8080 5d17h
$ kubectl exec -it calico-node-2vnrk -c calico-node -n kube-system -- calico-node -bpf nat dump |grep -A 5 10.96.179.217
10.96.179.217…

--

--

apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
annotations:
ingressclass.kubernetes.io/is-default-class: "true"
name: kong
spec:
controller: konghq.com/ingress-controller

The important part is “ingressclass.kubernetes.io/is-default-class: “true””

that’s.

--

--

To run Longhorn storage only on the specific nodes:

  • Download yaml manifest and update Longhorn config map “create-default-disk-labeled-nodes=true”
  • Apply yaml
  • Add label node.longhorn.io/create-default-disk=true to your dedicated storage nodes. Do nothing on another node.
  • Done
node 001–003 are storage nodes and others are compute node

For better result, you may apply taint to Longhorn nodes

That’s all

--

--

Sometime getting fact take long time to process

try this:

[defaults]gather_subset = min,network,!hardware

Next, looks wired ,but this can help me

ansible_ssh_common_args="-o ServerAliveInterval=15 -F /dev/null -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"

Hope this help.

--

--

Velero is a great tool to do full backup/restore your k8s cluster ,but sometime you need to clean install it this is how.

#!/bin/bashvelero uninstall
kubectl delete ns velero
kubectl delete ResticRepository -n velero $(kubectl get ResticRepository -n velero -o jsonpath='{.items[*].metadata.name}')
velero install \
-n velero \
--provider aws…

--

--

VirtualBox is my best friend for my Ansible testing and I need to re-create VMs all the time this is how

cd C:\Program Files\Oracle\VirtualBoxVBoxManage clonevm s201 --name="s201c1"  --snapshot s1 --options=keepallmacs,Link  --registerVBoxManage clonevm s202 --name="s202c1"  --snapshot s1 --options=keepallmacs,Link  --registerVBoxManage clonevm s203 --name="s203c1"  --snapshot s1 --options=keepallmacs,Link  --registerVBoxManage clonevm…

--

--

No need config map or config template file. just 2 ENVs can do this

- name: KONG_NGINX_HTTP_LOG_FORMAT
value: x_custom_format escape=json '{"time_local":"$time_local","remote_addr":"$remote_addr","server_addr":"$server_addr","scheme":"$scheme","host":"$host","status":$status,"request_method":"$request_method","uri":"$uri","qu
ery_string":"$query_string","server_protocol":"$server_protocol","bytes_sent":$bytes_sent,"body_bytes_sent":$body_bytes_sent,"request_length":$request_length,"http_referrer":"$http_referer","http_user_agent":"$http_user_agent","requ
est_time":"$request_time","upstream_response_time":"$upstream_response_time","upstream_addr":"$upstream_addr","http_content_type":"$sent_http_content_type","upstream_host":"$upstream_host"}'
- name: KONG_PROXY_ACCESS_LOG
value…

--

--

filter {
ruby {
code => "event.set('[@metadata][index]', event.get('[@timestamp]').time.localtime.strftime('%Y-%m-%d-%H'))"
}
ruby {
code => "event.set('[@metadata][timestamp]', event.get('[@timestamp]').time.localtime.strftime('%Y-%m-%d %H:%M:%S.%L'))"
}
}
input {
beats {
port => 1221
}
}
filter {
mutate {
lowercase => [ "[host][name]" ]
}
}
output {
file {
path => "/data/log/%{[host][name]}.server.log.%{[@metadata][index]}"
codec…

--

--

Jbn1233

Jbn1233

Very short and simple notes for CKA/SRE and may not works on your environment.