K8s/Ingress: Difference between revisions
Jump to navigation
Jump to search
Line 234: | Line 234: | ||
|valign='top'| | |valign='top'| | ||
* [https://medium.com/@heshani.samarasekara/expose-tcp-services-through-ingress-nginx-controller-ef135dbfae4d K8s » Ingress » Expose TCP services] | * [https://medium.com/@heshani.samarasekara/expose-tcp-services-through-ingress-nginx-controller-ef135dbfae4d K8s » Ingress » Expose TCP services] | ||
* [https://docs.k0sproject.io/v1.27.1+k0s.0/examples/ambassador-ingress/ K8s » Ingress » Ambassador] | |||
* [https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md K8s » Ingress » Annotations] | * [https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md K8s » Ingress » Annotations] | ||
* [https://stackoverflow.com/questions/51744536/ K8s » Ingress » CORS Rules] | * [https://stackoverflow.com/questions/51744536/ K8s » Ingress » CORS Rules] | ||
* [https://docs.k0sproject.io/v1.27.1+k0s.0/examples/metallb-loadbalancer/ K8s » Ingress » MetalLB] | |||
* [https://docs.k0sproject.io/v1.27.1+k0s.0/examples/traefik-ingress/ K8s » Ingress » Traefik] | |||
|valign='top'| | |valign='top'| |
Revision as of 20:27, 19 August 2024
External
kubectl get ns|grep external
kubectl delete namespace external
kubectl create namespace external
Internal
kubectl get ns|grep internal
kubectl delete namespace internal
kubectl create namespace internal
| ||
| ||
cat << YML|kubectl apply -n internal -f -
---
apiVersion: v1
kind: Service
metadata:
name: minikube-host
namespace: internal
labels:
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/managed-by: kubectl
app.kubernetes.io/name: minikube-host
app.kubernetes.io/instance: minikube-host
spec:
type: ExternalName
externalName: host.minikube.internal
YML
| ||
| ||
cat << YML | kubectl apply -n internal -f -
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: apache
namespace: internal
labels:
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/managed-by: kubectl
app.kubernetes.io/name: minikube-host
app.kubernetes.io/instance: minikube-host
spec:
ingressClassName: nginx
rules:
- host: "host.k8s.local"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: minikube-host
port:
number: 2013
YML
|
cat << YML | kubectl apply -n internal -f -
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minio
namespace: internal
labels:
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/managed-by: kubectl
app.kubernetes.io/name: minikube-host
app.kubernetes.io/instance: minikube-host
spec:
ingressClassName: nginx
rules:
- host: "minio.host.k8s.local"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: minikube-host
port:
number: 9801
- path: /files/
pathType: ImplementationSpecific
backend:
service:
name: minikube-host
port:
number: 9800
YML
|
ConfigMap
ConfigMap » TCPcat << YML | kubectl apply -n ingress-nginx -f -
---
apiVersion: v1
kind: ConfigMap
metadata:
name: tcp-services
namespace: ingress-nginx
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
data:
"5432": "internal/minikube-host:5432"
YML
|
ConfigMap » UDPcat << YML | kubectl apply -n ingress-nginx -f -
---
apiVersion: v1
kind: ConfigMap
metadata:
name: udp-services
namespace: ingress-nginx
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
data:
"1194": "internal/minikube-host:1194"
YML
|
Playground
kubectl -n ingress-nginx exec -it svc/ingress-nginx-controller -- cat template/nginx.tmpl
kubectl -n ingress-nginx exec -it svc/ingress-nginx-controller -- cat /etc/resolv.conf
kubectl -n ingress-nginx exec -it svc/ingress-nginx-controller -- cat nginx.conf
kubectl -n ingress-nginx exec -it svc/ingress-nginx-controller -- cat /etc/hosts
| ||
| ||
kubectl -n external get endpoints
kubectl -n external get service
kubectl -n external get ingress
|
kubectl -n internal get endpoints
kubectl -n internal get service
kubectl -n internal get ingress
|
kubectl config get-contexts
sudo -i -u minikube
helm list -A
|
| ||
kubectl get all -A
kubectl get ns
|
kubectl -n ingress-nginx exec -it svc/ingress-nginx-controller -c controller -- bash
kubectl -n ingress-nginx exec -it svc/ingress-nginx-controller -- bash
| |
| ||