K8s/Service: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==External== <syntaxhighlight lang="bash"> kubectl config get-contexts kubectl get ns|grep external kubectl create namespace external </syntaxhighlight> ==Internal== {| |colspan='3'| <syntaxhighlight lang="bash"> kubectl config get-contexts kubectl get ns|grep internal kubectl create namespace internal </syntaxhighlight> |- |colspan='3'| ---- |- |valign='top'| <syntaxhighlight lang="yaml"> cat << YML|kubectl apply -n internal -f - --- apiVersion: v1 kind: Service metad...") |
|||
Line 172: | Line 172: | ||
{| | {| | ||
|valign='top'| | |valign='top'| | ||
* [[K8s/CSI Hostpath Driver]] | * [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]] | ||
* [[K8s/Swiss Knife]] | * [[K8s/Swiss Knife|K8s » Swiss Knife]] | ||
* [[K8s/Ingress]] | * [[K8s/Ingress|K8s » Ingress]] | ||
* [[K8s/Run]] | * [[K8s/Run|K8s » Run]] | ||
|valign='top'| | |valign='top'| |
Revision as of 21:30, 6 September 2024
External
kubectl config get-contexts
kubectl get ns|grep external
kubectl create namespace external
Internal
kubectl config get-contexts
kubectl get ns|grep 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
|
||
| ||
Ingress » Nginx
kubectl config get-contexts
kubectl get ns|grep ingress-nginx
| ||
| ||
cat << YML | kubectl apply -n ingress-nginx -f -
---
apiVersion: v1
kind: Service
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
type: LoadBalancer
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
- name: https
port: 443
targetPort: 443
protocol: TCP
- name: proxied-tcp-5432
port: 5432
targetPort: 5432
protocol: TCP
- name: proxied-tcp-6379
port: 6379
targetPort: 6379
protocol: TCP
- name: proxied-udp-1194
port: 1194
targetPort: 1194
protocol: UDP
- name: proxied-udp-53
port: 53
targetPort: 53
protocol: UDP
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
YML
|
Playground
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
| |
| ||
References
| ||