Minikube Ingress DNS: Difference between revisions
Jump to navigation
Jump to search
Line 238: | Line 238: | ||
| valign="top" | | | valign="top" | | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
ip -j link show | jq -r '.[]|select(.link_type=="ether").ifname' | |||
ip -j link show type bridge | jq -r '.[].ifname' | ip -j link show type bridge | jq -r '.[].ifname' | ||
ip -o link show | awk -F': ' '{print $2}' | ip -o link show | awk -F': ' '{print $2}' |
Revision as of 03:17, 8 June 2024
minikube stop
minikube delete --all
rm -rf ${HOME}/.minikube/*
|
minikube start
minikube docker-env
minikube addons list
|
minikube addons enable ingress
minikube addons enable ingress-dns
minikube addons enable metrics-server
|
| ||
kubectl get ns
kubectl get all
kubectl get all -A
kubectl get pods -A
kubectl get namespaces
|
minikube kubectl -- get ns
minikube kubectl -- get all
minikube kubectl -- get all -A
minikube kubectl -- get pods -A
minikube kubectl -- get namespaces
|
kubectl get all -n kube-system
kubectl get configmap -n kube-system
kubectl get configmap coredns -n kube-system
kubectl edit configmap coredns -n kube-system
kubectl get configmap coredns -n kube-system -o yaml
|
Ingress DNS
kubectl edit configmap coredns -n kube-system apiVersion: v1
data:
Corefile: |
.:53 {
log
errors
reload
loadbalance
}
k8s.local:53 {
errors
cache 30
forward . 192.168.49.2
}
academia.local:53 {
errors
cache 30
forward . 192.168.49.2
}
kind: ConfigMap
metadata:
creationTimestamp: "2023-07-04T00:08:54Z"
name: coredns
namespace: kube-system
resourceVersion: "300"
uid: d8eec45d-1452-467f-8861-8811658c773a
| |
K8s » Dashboard | |
cat <<EOF | kubectl apply -n kubernetes-dashboard -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kubernetes-dashboard
labels:
helm.sh/chart: kubernetes-dashboard-1.0.0
app.kubernetes.io/name: kubernetes-dashboard
app.kubernetes.io/instance: kubernetes-dashboard
app.kubernetes.io/version: "1.0.0"
app.kubernetes.io/managed-by: Helm
spec:
ingressClassName: nginx
rules:
- host: "www.k8s.local"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: kubernetes-dashboard
port:
number: 80
EOF
|
cat <<EOF | kubectl delete -n kubernetes-dashboard -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kubernetes-dashboard
labels:
helm.sh/chart: kubernetes-dashboard-1.0.0
app.kubernetes.io/name: kubernetes-dashboard
app.kubernetes.io/instance: kubernetes-dashboard
app.kubernetes.io/version: "1.0.0"
app.kubernetes.io/managed-by: Helm
spec:
ingressClassName: nginx
rules:
- host: "www.k8s.local"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: kubernetes-dashboard
port:
number: 80
EOF
|
| |
kubectl run -i --tty --rm debug --image=alpine --restart=Never -- nslookup www.k8s.local
kubectl run -i --tty --rm debug --image=alpine --restart=Never -- ping www.k8s.local
nslookup www.k8s.local $(minikube ip)
| |
K8s » DNS Config | |
RESOLVE='/etc/resolv.conf';\
printf -v K8S_DNS '%s' $(minikube ip);\
if [ -f ${RESOLVE} ]&&[ "$(grep -c ${K8S_DNS} ${RESOLVE})" == 0 ];then\
cat << EOF | sudo tee -a ${RESOLVE} >/dev/null
nameserver ${K8S_DNS}
EOF
fi;\
cat ${RESOLVE}
| |
| |
nslookup www.k8s.local
|
ping www.k8s.local
|
| |
xdg-open http://www.k8s.local &>/dev/null &
gnome-open http://www.k8s.local &>/dev/null &
|
x-www-browser http://www.k8s.local &>/dev/null &
sensible-browser http://www.k8s.local &>/dev/null &
|
Playground
minikube status -f '{{.Kubeconfig}}'
minikube status -f '{{.APIServer}}'
minikube status -f '{{.Kubelet}}'
minikube status -f '{{.Worker}}'
minikube status -f '{{.Host}}'
|
minikube status -o 'json' | jq -r '.Kubeconfig'
minikube status -o 'json' | jq -r '.APIServer'
minikube status -o 'json' | jq -r '.Kubelet'
minikube status -o 'json' | jq -r '.Worker'
minikube status -o 'json' | jq -r '.Host'
|
ip -j link show | jq -r '.[]|select(.link_type=="ether").ifname'
ip -j link show type bridge | jq -r '.[].ifname'
ip -o link show | awk -F': ' '{print $2}'
ip -j link show | jq -r '.[].ifname'
ls /sys/class/net
|
| ||
minikube status -f '{{- if .TimeToStop }} timeToStop: {{.TimeToStop}} {{- end }}'
minikube status -f '{{- if .DockerEnv }} docker-env: {{.DockerEnv}} {{- end }}'
minikube status -o 'json' | jq
| ||
| ||
References
| ||