18. おすすめしない理由
Kubernetesでは特に
Client
Load Balancer/
Gateway / Proxy
Server side
App Pod
Server side
App Pod
Session
Client
Session
KubernetesのPodは、アプリの更新、リソース不足による排出、ノードメンテナンスなど、様々な
理由で再作成されます
graceful shutdownを実現する仕組みはありますが、そのタイミングでセッション情報をPod外部に
退避させるようなアプリを作れるのであれば、はじめからデータストアに持ったほうがよいです
Server side
App Pod
すぅーっ
わたくし
ドロンさせて
いただきます
Podのヤツ また突然
いなくなったよ…
26. --- create_map generates the node hash table
-- @tparam {[string]=number} nodes A table with the node as a key and its weight as a value.
-- @tparam string salt A salt that will be used to generate salted hash keys.
local function create_map(nodes, salt)
local hash_map = {}
for endpoint, _ in pairs(nodes) do
-- obfuscate the endpoint with a shared key to prevent brute force
-- and rainbow table attacks which could reveal internal endpoints
local key = salt .. endpoint
local hash_key = ngx.md5(key)
hash_map[hash_key] = endpoint
end
return hash_map
end
ハッシュ生成コード
ingress-nginx/nodemap.lua