Minikube Ingress DNS: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 52: | Line 52: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |||
==Ingress DNS== | |||
{| | |||
|colspan="2"| | |||
'''Volatile Fixes''' | |||
<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"| | |||
---- | |||
|- | |||
|colspan="2"| | |||
kubectl edit configmap coredns -n kube-system | |||
<syntaxhighlight lang='properties' line start='5'> | |||
apiVersion: v1 | |||
data: | |||
Corefile: | | |||
.:53 { | |||
log | |||
errors | |||
</syntaxhighlight> | |||
---- | |||
<syntaxhighlight lang='properties' line start='30' highlight='4-13'> | |||
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 | |||
</syntaxhighlight> | |||
|- | |||
|colspan="2"| | |||
---- | |||
'''K8s » Dashboard''' | |||
---- | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang="properties"> | |||
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 | |||
</syntaxhighlight> | |||
|valign='top'| | |||
<syntaxhighlight lang="properties"> | |||
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 | |||
</syntaxhighlight> | |||
|- | |||
|colspan="2"| | |||
---- | |||
|- | |||
|colspan="2"| | |||
kubectl run -i --tty --rm debug --image=busybox --restart=Never -- nslookup www.k8s.local | |||
kubectl run -i --tty --rm debug --image=busybox --restart=Never -- ping www.k8s.local | |||
---- | |||
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 | |||
|} | |} | ||
Revision as of 00:58, 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
Volatile Fixes 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}
| |
| |
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=busybox --restart=Never -- nslookup www.k8s.local kubectl run -i --tty --rm debug --image=busybox --restart=Never -- ping www.k8s.local 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 |
References
| ||