![](/img/trans.png)
[英]Not able to install the nginx-ingress on azure kubernetes cluster
[英]How can I add my external domain “uat.test.com ” to my kubernetes cluster by using nginx-ingress?
我是 kubernetes 的新手,并且对于来自 godaddy 的外部域的入口 nginx 有问题。 它被称为“ https://uat.test.com ”。我为 nginx-ingress 创建了一些 yaml 但我做不到。 如何使用 nginx-ingress 将“uat.test.com”添加到我的 kubernetes 集群?
以下; 它们是我有趣和有压力的冒险的步骤。
az group create --name aks-group --location eastus2
az aks create --resource-group aks-group --name aks-cluster --node-count 3 --generate-ssh-keys -s Standard_B2ms --disable-rbac
kubectl create namespace ingress-basic
az aks get-credentials -g aks-group -n aks-cluster
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.43.0/deploy/static/provider/cloud/deploy.yaml
az aks get-credentials -g aks-group -n aks-cluster
kubectl --namespace ingress-basic get services -o wide -w nginx-ingress-ingress-nginx-controller
helm install ingress-nginx ingress-nginx/ingress-nginx
helm repo update
helm install nginx-ingress ingress-nginx/ingress-nginx --namespace ingress-basic --set controller.replicaCount=2
kubectl --namespace ingress-basic get services -o wide -w nginx-ingress-ingress-nginx-control
apiVersion: apps/v1
kind: Deployment
metadata:
name: aks-helloworld-one
spec:
replicas: 1
selector:
matchLabels:
app: aks-helloworld-one
template:
metadata:
labels:
app: aks-helloworld-one
spec:
containers:
- name: aks-helloworld-one
image: mcr.microsoft.com/azuredocs/aks-helloworld:v1
ports:
- containerPort: 80
env:
- name: TITLE
value: "Welcome to Azure Kubernetes Service (AKS)"
---
apiVersion: v1
kind: Service
metadata:
name: aks-helloworld-one
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: aks-helloworld-one
kubectl apply -f aks-helloworld-one.yaml --namespace ingress-basic
aks-helloworld-two.yml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: aks-helloworld-two
spec:
replicas: 1
selector:
matchLabels:
app: aks-helloworld-two
template:
metadata:
labels:
app: aks-helloworld-two
spec:
containers:
- name: aks-helloworld-two
image: mcr.microsoft.com/azuredocs/aks-helloworld:v1
ports:
- containerPort: 80
env:
- name: TITLE
value: "AKS Ingress Demo"
---
apiVersion: v1
kind: Service
metadata:
name: aks-helloworld-two
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: aks-helloworld-two
kubectl apply -f aks-helloworld-two.yaml --namespace ingress-basic
hello-world-ingress.yml:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: hello-world-ingress
namespace: ingress-basic
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: uat.test.com
http:
paths:
- backend:
serviceName: aks-helloworld-one
servicePort: 80
path: /hello-world-one(/|$)(.*)
- backend:
serviceName: aks-helloworld-two
servicePort: 80
path: /hello-world-two(/|$)(.*)
- backend:
serviceName: aks-helloworld-one
servicePort: 80
path: /(.*)
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: hello-world-ingress-static
namespace: ingress-basic
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/rewrite-target: /static/$2
spec:
rules:
- http:
paths:
- backend:
serviceName: aks-helloworld-one
servicePort: 80
path: /static(/|$)(.*)
kubectl apply -f hello-world-ingress.yaml
当我写地址“https://uat.test.com”
// 如评论中所述
在某个地方,您需要将集群入口 controller 的公共 IP 地址绑定到您的 DNS 名称。 这不会发生在 AKS(或您的 k8s 配置中的任何地方)中。 您需要使用 DNS 提供程序来执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.