Kubernetes – Ingress access from certain IP

ingress.yml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: artem-services-ing
  namespace: staging
  annotations:
    kubernetes.io/ingress.class: ingress-staging
    certmanager.k8s.io/cluster-issuer: letsencrypt-staging
    certmanager.k8s.io/acme-challenge-type: dns01
    certmanager.k8s.io/acme-dns01-provider: dns
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/server-snippet: |
      if ($remote_addr !~ "^(1.1.1.1|2.2.2.2|3.3.3.3)$") {
        return 403;
      }

spec:
  tls:
  - hosts:
    - artem.services
    secretName: artem.services-secret-tls
  rules:
  - host: artem.services
    http:
      paths:
      - path: /
        backend:
          serviceName: artem-services-svc
          servicePort: 80

Tagged: Tags

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments