LoginSignup
0
0

More than 5 years have passed since last update.

ACS(Kubernetes) whiltelisting

Posted at

ACS (Kubernetes)のホワイトリスティングについて聞かれたので、ちょっと試してみた。

Nginx ingress controller だとできそうだけど、L4 LoadBalancer でもできるという記述があった。

*Status of Kubernetes on Azure
* Source IP whitelisting

結論からいうと、loadBalancerSourceRanges が使える

kubectl run nginx --image nginx
kubectl expose deployment nginx --port=80 --type=LoadBalancer
kubectl edit svc/nginx

あたりで編集。{YOUR_IP_ADDRESS}に自分のIPを入れる。あなたが現在インターネットに接続しているグローバルIPアドで調べると良い。

spec:
  clusterIP: 10.0.113.195
  externalTrafficPolicy: Cluster
  ports:
  - nodePort: 31539
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    run: nginx
  sessionAffinity: None
  type: LoadBalancer
  loadBalancerSourceRanges:
    - {YOUR_IP_ADDRESS}/32

自分のブラウザからはアクセスできるが、携帯からやると、ちゃんとブロックされる。

ちなみに、こうなると、Express Routeからきた時は、どうなるだろうとか考えてしまう。
またそれは次回以降。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0