我的本地应用程序与Kubernetes / Traefik有一个本地域rgpd.local

时间:2019-10-22 09:49:25

标签: kubernetes traefik kubernetes-ingress traefik-ingress

现在,我可以使用以下命令测试本地应用程序:http://localhost/rgpd/api/...

这是我的rgpd-ingress.yaml

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: rgpd-ingress
  namespace: rgpd
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - http:
      paths:
      - path: /rgpd/api
        backend:
          serviceName: rgpd-api-local
          servicePort: "rgpd-port"

我想将其更改为:rgpd.local

所以我将其更改为:

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: rgpd-ingress
  namespace: rgpd
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: rgpd.local
    http:
      paths:
      - backend:
         serviceName: rgpd-api-local
         servicePort: "port-rgpd"

但是,现在,如果我输入旧网址,则会得到404,也无法连接新网址。

这是我的文件:

部署:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    reloader.stakater.com/auto: "true"
  labels:
    app: rgpd-api-local
  name: rgpd-api-local
  namespace: rgpd
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: rgpd-api-local
    spec:
      containers:
        - image: rgpd_api:local
          envFrom:
            - secretRef:
                name: rgpd-env
          name: rgpd-api-local
          ports:
            - containerPort: 10000

服务:

apiVersion: v1
kind: Service
metadata:
  labels:
    app: rgpd-api-local
  name: rgpd-api-local
  namespace: rgpd
spec:
  type: NodePort
  ports:
  - name: "rgpd-port"
    port: 10000
  selector:
    app: rgpd-api-local

为什么不能正常工作?

2 个答案:

答案 0 :(得分:0)

在主机文件中添加一个条目: / etc / hosts rgpd.local 127.0.0.1

答案 1 :(得分:0)

更新library("readr") library("dplyr") sma <- read.csv(file="/home/kabir/docs/assignment/stat/data/data.csv", header=TRUE, sep=",") sma$Smartphone_brand <- as.character(sma$Smartphone_brand) sma$Smartphone_brand[sma$Check_in_five_minutes == "Yes" ] brand_causes_problem <- sma$Smartphone_brand[sma$Communication_problem == "Yes" | sma$Headache_problem == "Yes" | sma$Anxiety_problem == "Yes" | sma$Depression_problem == "Yes"] brand_causes_problem <- unique(brand_causes_problem, na.rm = TRUE) brand_causes_problem plot(brand_causes_problem, sma$Age) plot(sma$Age, sma$Call_amount) sma$Call_amount[sma$Name == "Kabir Nayeem"] 或仅提供主机标头,即/etc/hosts