Minikube Ingress DNS: Difference between revisions
Jump to navigation
Jump to search
Line 56: | Line 56: | ||
==Ingress DNS== | ==Ingress DNS== | ||
{| | {| | ||
|colspan="2"| | |colspan="2"| | ||
---- | ---- | ||
Line 177: | Line 162: | ||
|- | |- | ||
|colspan="2"| | |colspan="2"| | ||
<syntaxhighlight lang='bash'> | |||
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) | |||
</syntaxhighlight> | |||
|- | |||
|colspan="2"| | |||
---- | ---- | ||
|- | |||
|colspan="2"| | |||
<syntaxhighlight lang='bash'> | |||
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} | |||
</syntaxhighlight> | |||
|- | |||
|colspan="2"| | |||
---- | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang="properties"> | |||
nslookup www.k8s.local | |||
</syntaxhighlight> | |||
|valign='top'| | |||
<syntaxhighlight lang="properties"> | |||
ping www.k8s.local | |||
</syntaxhighlight> | |||
|- | |||
|colspan="2"| | |||
---- | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang="properties"> | |||
xdg-open http://www.k8s.local &>/dev/null & | |||
gnome-open http://www.k8s.local &>/dev/null & | |||
</syntaxhighlight> | |||
|valign='top'| | |||
<syntaxhighlight lang="properties"> | |||
x-www-browser http://www.k8s.local &>/dev/null & | |||
sensible-browser http://www.k8s.local &>/dev/null & | |||
</syntaxhighlight> | |||
|} | |} | ||
Revision as of 02:04, 27 May 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)
| |
| |
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 &
|
References
| ||