mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Add basic auth to k8s dashboard
This commit is contained in:
parent
d8d9733ed9
commit
2315ed19df
4 changed files with 75 additions and 99 deletions
|
|
@ -1,88 +1,67 @@
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
34396532356664616238616439303637376436383835356365663962623232653431333838353833
|
39343030626131366637383233373465646530616362383232663565646664393131613661316430
|
||||||
6265333930636437313962616132623535373831363462340a323431346162633731626161386162
|
6635346564373661666365343565356636383563323563380a356133343764356465636562343862
|
||||||
37303239623761663639393130366563353961646261363032393437316434343237313164343137
|
65353235326639313138663836623465373164343464326662393866636463326361303438363736
|
||||||
6330613465663433360a613864396335303430343133313164343133313632653430643439353632
|
3239313937366465640a656563393130306234633534353261643565363738633562656264613261
|
||||||
35363432383436356564393362333066303936616634303064376662663331643039386330333332
|
38616261323766373233386538383038623332353131323132613465643265376162323638633136
|
||||||
30333563346237366165306464393532333738333336656537353237343835613865616137356132
|
65633061353539323737343730613838613531326661653839363532643263653033326566646261
|
||||||
63366631623535343339666335336365393065616233633033343966396235326165383565616666
|
63623733643761353238643663666362646431613963613339633764333265613638393431363662
|
||||||
31646437656438376263363337393331646466333231346332613863633865353564356631343362
|
36366232643135383133613633643030626630353730333036646365393764666662366363376362
|
||||||
39353431326363646265666533643364653563376333626562376461623264343836306362616237
|
34373463373734383463613933663339363837333933353161663064646337393736323932363131
|
||||||
34636632633130623131313463343730613265613232663131373334376466326133303630313863
|
63643131656231613538626139333736623061343630333466623835383264346265616431643832
|
||||||
38643862653335633964393432656336366465393566623830313235373034373166386165636535
|
34356139316537616436643664613561323766333631633332373662376538346363326635346638
|
||||||
32373637333735363936666135303531633265323831613738373466313536356439643139326666
|
33373566623434363336393234623362616464356438326537346530313961356238326635396335
|
||||||
39613431323735376431616165663661626334353466353731373830343935666164633239653838
|
63316633663533653034623531643935316230333730383930666265616461396566663835653535
|
||||||
30366331623662393264336238376434323065386235343933353364356536636165623231623162
|
38653165393738363662353239353937326239643961343539393761393035323265666663306265
|
||||||
37393330663836653661643161633763626338626531643561303962383934336564373332393561
|
62373438643264636662396333396436613864396166363434306238656634383864643362313935
|
||||||
33653935313437626361313661643934333934313432366232656338393732646366643965623135
|
37616532653266363339323063663861373136646565313964656333613461663261336437633864
|
||||||
64343664323664323538373637306439613465343638366238333437326563323531396666353635
|
63383434313038383161626564643839613265386635643534336631386362303539653737333936
|
||||||
38333934653332653336353330663763353534646261383261653934323963663038393135643565
|
33636236613961613134353033316263653266623032616662623661653031633162303138653064
|
||||||
36343031343263323632353734646633343534613739316633393238316332623262633065623237
|
30663132616262626635346439626163393032663630316336326534353532646236386361633930
|
||||||
32323832663761353332643331363835303039363231383264373733653935306361393634373837
|
63383939613137333239643766636235383166396464613465393862336532366639666635636564
|
||||||
36343536333530626238383866653136343034346666313866366330633439663665306361383436
|
65336633336366326239643236313438323036366364336239373735643663663061356532343336
|
||||||
36323833623136373038343435656465323835383236653039636436613461363437323162333433
|
37323866623736316162643834336332303764663337643230303638326133326362636631363133
|
||||||
63643864363261666138303931613938663561653430666238643036643635373831333536646130
|
65343563633833333131383639316666306539306236343332646136646634316130623165623930
|
||||||
37393532356435316136316239366538653331643663646662313032646133343562383663616131
|
38653135666266656561393462623062313036363135343136613364333730343534626137313065
|
||||||
62653838666432376630313031353030633834396166393364393239316366626339633233613831
|
64353832343166356261303466623134343536333162626565666564653033326434366163393161
|
||||||
35616363633131336137616436346232633963343332303464333764343462626232396336373033
|
37376232613232323637376133393739333138343439643235646163346238656164333962633431
|
||||||
64623135306432343233306562376564376334366631353330623462303466326265363031626662
|
31303361376563336366663538386637373132303364376635316666393039383861363734646566
|
||||||
33663131623964393531343036616531306336656561313832343865383061376566623330373962
|
34303435393432633038643737333534306566303838396130346465643561363364633439333437
|
||||||
35643231333066666437653033623736356137343764366130383864323432386135383965333533
|
38623536326166346137376330623036313262623639643535393638326561376461313336383733
|
||||||
35656637393239653234646538663434343331323435373838393138613739653362346364616336
|
63616562613930646135616134376563626239653933666264326633303136386564636632613063
|
||||||
64663934396332313163656464656537343234653533386535343238376630636334306635613438
|
62313338326466396330623234336237393037666361626663373933313533626333626662353333
|
||||||
65356161326666613830636566393864373766326664373363323765353032366435346264383263
|
34663533326136343363626536653536636230316563646663626666613865366236643538373438
|
||||||
37346433346565636531316466303834636166636131396534316664303834386362633337666130
|
32626332383330323431326333356437323239323366383932393662343732646363363337393663
|
||||||
32636538306464363064383036326363316630316266393239363332353733363263663139666432
|
65663637393064636337343666363237316339623235356364363636316133663561306564623734
|
||||||
32626464383463386636363465643637613335326235376462353136356234613262333861373236
|
30613662616430373234633061356361303261333434313662323766343764633866313766363036
|
||||||
39383935643633373161373437653338313764323536316461333466396138363962333936353133
|
65313735386533643437313235346261393563393537646565363033383830353034393236313462
|
||||||
34613132363334373461353461336535333030343964363931363562333961333938633765363936
|
35386238323137666333393934613037613137323663653034383661383466373935303136626466
|
||||||
38636162316333336536643138316332636536383865313632306334653561356331376162336332
|
36646436343138356635383036633362636331616137303131383831366336303036643838393866
|
||||||
62356166373362313033663836373437313932393461383637393137363961373331626334396231
|
39393935623830383966643636333531626633366537396163373138356166346133343031303234
|
||||||
37643564613633336234653135633231623063653431653933623230323265626236386338643631
|
33346330623635396330616538386663396261616137346438616262626633376634626266383336
|
||||||
39326264313462373563353535376365623163396633333163633161323538666639333938303966
|
30363334633136366366343335653463383238656461643163326261623936396366363230363235
|
||||||
38656362643437363265333032303231376631633462373730303235663232626231376438616266
|
31373364306531633132613939633261326434316162353063323466643464393663333061313461
|
||||||
66383266656563643836323037393238666164363133653838333138663631336532346135613732
|
37633935393537663936333234386131313733316430633633373865626164303038353033313164
|
||||||
32633765346364386365666163366263333461313535343837323764623237666166636166613730
|
64383461356438376534366362363538363264636666653739343363616234383138626562643339
|
||||||
65636131636561356663383439616530633362303037393935323031353464376338366565643330
|
30306238343163636164313762656537393635376262336361333363306633366465663033366139
|
||||||
66656139363461336632626364633930313139306263353434346662646339313739303762343261
|
34323035323531353137666537616238653539663534383661393235376330653437353538313566
|
||||||
39633762363430383963346639656263303437343536336163636265636335653265333833373665
|
33373935326463356333316234373565343731323063366533333332333338356336396565333637
|
||||||
30333462333566653837613832323430663364393535616533353038356136326366626562373736
|
30663934383830376235376232363463366137623533353832386261393932353165393836626562
|
||||||
63646536666166313038326261303839393235303730613762313063373437393431373261393839
|
35373661363637646233353038373465363064623464386165343263363639623930313461323162
|
||||||
32366230333139313138376662653765393336646532353534343437383330313237363636326239
|
61323764366232626665656363373737343166336534376565353830643433623363363033323364
|
||||||
64383165653163366637316465396135666466353538636236313532363462623032373565653934
|
63333939636630383662386135663638333138323837626533636133346339326530313339386663
|
||||||
34366238363938303630613635633164393030666333396166383963646165333237616261613030
|
30336465633932616264323330653665616436346137633339376232353161663336313564666464
|
||||||
35633164343232663238633563353534343532346265646561306437616262616532333535333364
|
33636533346563333066656238666236653537636362343339636661376361376461313733663661
|
||||||
38623934316537633164376639613564633036373334303131386166353737656131623066656162
|
62333161646633376537633166643864643839356231613333663565383266643361663034326662
|
||||||
65656439666233376337653865663465303032616538363364363239336431653139313265376332
|
63663835643537643434316462613832323063663736666437396463396564373464366134303565
|
||||||
39333131626336396261663530323335613839333833393333333665366266323535656633343465
|
38373033336465353734313737613633633064623862306230653231653530613337393366363266
|
||||||
62636461373832393939323763626332323536353762376366616136396665633033346539353034
|
37616366333532316331306337323233633730396637353564363438323462353361626137333431
|
||||||
33303465613434313166643431653836386466383732663630663138323466393963646331393962
|
30383262343666623066376630343631353134306562393635633231396531363665643530363461
|
||||||
35366331353839353835363035383662366130313864353433383837663161336465376262636231
|
66613530663061306433396165336531656437396330313663316432616131623563353432346330
|
||||||
66663038383039646561303235313930366263366365323863386335343730323534316666333237
|
36663361336633313863633534373961666134623539363631393532353133616536333061353065
|
||||||
31653166333132353533343637656238383137346231623232303166373436373833643439303037
|
33303637376539373636666536333432343834373632343434633063353639663138313936373534
|
||||||
34326237373866353632346465636636346463373364373461393266666434353434353536663463
|
31356332373839306230636139333133613932366164306338616539346365663739313439653438
|
||||||
38343366646630333662393463373763636339383562313533343332623831306634313737663630
|
61663831613135643731633633633162666339303261306435626565383238653434613165346237
|
||||||
66346638346366353537643436326538356661343638356334343739346438396434333330313066
|
61393236353539376639333464323337313231316633663764343662356335653931396136383563
|
||||||
37656235323039356165663361336461306265303264363434656165363663613663643639383462
|
30363130623464653961613630333333333736353539306637303863313232383838636539636334
|
||||||
61306334626336636134313066656463656363633862643564326330643435386433306232323863
|
6537376261323661376566393161336662666336353736383061
|
||||||
37633239633366336266366233343031656439343666656130653366336332663439356131653236
|
|
||||||
64383761366239323038386535323933383466633864613066313230386535333363343830633234
|
|
||||||
64373436363831663437353335316531306437633937666133643665653662326263373431616561
|
|
||||||
66613230663136343330386231623634363763396365653734383938386364303064323933376639
|
|
||||||
37376663393065363661353232313030666535643633366133303639343031353938393430353432
|
|
||||||
62376165323737336132396361353037613832316562646663646539336132336236613336666431
|
|
||||||
66363232366434663936386465313634313639636633346633636433663165366361613861323062
|
|
||||||
62313836663364326365616139663066376531393135343933386236323165653334376265343238
|
|
||||||
39323466643031396663356237626364653462396264316233323838363563356663316335323261
|
|
||||||
61303335646265376261353330376165666462353635666338353036633533393764323831383536
|
|
||||||
39363431373831643637333337656539636433646665376336336632653135326461316232613037
|
|
||||||
36626465303439346635316536376163343638353639303636366163363633633965353033663964
|
|
||||||
64363032656633303139316165323538386461376238313630653264643963366130626263303934
|
|
||||||
33636335646663643666656133366536343162333036663134663034393735313830626339303139
|
|
||||||
36343932323539393061643063613736353035633336613839616238386234653634356661663637
|
|
||||||
32363439316662626430353435373030346465346339653733366539633566336537323433323665
|
|
||||||
36366162363030623139383962343964336131373764636433323165353534323232383666353965
|
|
||||||
65383865643538663561353666333430366165666263323432613736336565316338393935393838
|
|
||||||
36356639363061663862373833613334666564343634616237346332376436626630373933383365
|
|
||||||
36336564626334356432643132623466633364663631616638363136376464386465656438303231
|
|
||||||
663039343938383434326237303934336564
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
# set basic_auth_user as non-empty to enforce basic auth
|
# set basic_auth_user as non-empty to enforce basic auth
|
||||||
basic_auth_user: ""
|
dashboard_basic_auth_user: ""
|
||||||
basic_auth_password: ""
|
dashboard_basic_auth_password: ""
|
||||||
|
|
||||||
# e.g. the fqdn would be k8s.yourdomain.tld if
|
# e.g. the fqdn would be k8s.yourdomain.tld if
|
||||||
# dashboard_subdomain=k8s
|
# dashboard_subdomain=k8s
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
- block:
|
- block:
|
||||||
- name: Installing python-passlib
|
- name: Installing python-passlib
|
||||||
apt:
|
apt:
|
||||||
name: python-passlib
|
name: python3-passlib
|
||||||
state: latest
|
state: latest
|
||||||
register: result
|
register: result
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
- name: Creating htpasswd file if k8s has basic auth
|
- name: Creating htpasswd file if k8s has basic auth
|
||||||
htpasswd:
|
htpasswd:
|
||||||
path: /tmp/auth
|
path: /tmp/auth
|
||||||
name: "{{ basic_auth_user }}"
|
name: "{{ dashboard_basic_auth_user }}"
|
||||||
password: "{{ basic_auth_password }}"
|
password: "{{ dashboard_basic_auth_password }}"
|
||||||
when: inventory_hostname == initial_master
|
when: inventory_hostname == initial_master
|
||||||
|
|
||||||
- name: Getting secrets
|
- name: Getting secrets
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
state: absent
|
state: absent
|
||||||
when: inventory_hostname == initial_master
|
when: inventory_hostname == initial_master
|
||||||
|
|
||||||
when: basic_auth_user | length > 0
|
when: dashboard_basic_auth_user | length > 0
|
||||||
|
|
||||||
- name: Templating manifests
|
- name: Templating manifests
|
||||||
template:
|
template:
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,9 @@ metadata:
|
||||||
name: kubernetes-dashboard
|
name: kubernetes-dashboard
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: traefik
|
kubernetes.io/ingress.class: traefik
|
||||||
{% if basic_auth_user | length > 0 %}
|
{% if dashboard_basic_auth_user | length > 0 %}
|
||||||
ingress.kubernetes.io/auth-type: basic
|
traefik.ingress.kubernetes.io/auth-type: basic
|
||||||
# name of the secret that contains the user/password definitions
|
traefik.ingress.kubernetes.io/auth-secret: dashboard-basic-auth
|
||||||
ingress.kubernetes.io/auth-secret: dashboard-basic-auth
|
|
||||||
# message to display with an appropiate context why the authentication is required
|
|
||||||
ingress.kubernetes.io/auth-realm: "Authentication is required to access the k8s dashboard "
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
spec:
|
spec:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue