add
This commit is contained in:
45
998-常用脚本/部署脚本/nginx暴露/设置ingress-nginx.sh
Normal file
45
998-常用脚本/部署脚本/nginx暴露/设置ingress-nginx.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
modify_ingress_nginx_host_network(){
|
||||
echo "start to modify hostnetwork to false !"
|
||||
kubectl patch daemonset nginx-ingress-controller -n ingress-nginx --patch '{"spec":{"template":{"spec":{"hostNetwork": false}}}}'
|
||||
echo ""
|
||||
kubectl get daemonset -n ingress-nginx nginx-ingress-controller -o jsonpath='{.spec.template.spec.hostNetwork}'
|
||||
}
|
||||
|
||||
build_for_ingress_nginx_node_port(){
|
||||
echo "start to write ingress nginx node port service !"
|
||||
mkdir -p /root/wdd/install/
|
||||
cat >>/root/wdd/install/k8s-ingress-nginx.yaml<<EOF
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: ingress-nginx-service
|
||||
namespace: ingress-nginx
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30500
|
||||
- name: https
|
||||
protocol: TCP
|
||||
port: 443
|
||||
targetPort: 443
|
||||
nodePort: 31500
|
||||
selector:
|
||||
app: ingress-nginx
|
||||
type: NodePort
|
||||
sessionAffinity: None
|
||||
EOF
|
||||
echo ""
|
||||
kubectl apply -f /root/wdd/install/k8s-ingress-nginx.yaml
|
||||
}
|
||||
|
||||
modify_ingress_nginx_host_network
|
||||
|
||||
build_for_ingress_nginx_node_port
|
||||
|
||||
|
||||
Reference in New Issue
Block a user