Skip to content

Instantly share code, notes, and snippets.

@ellieayla
Last active April 15, 2022 00:58
Show Gist options
  • Save ellieayla/ac890649c5b484062dedf98ae1f186ec to your computer and use it in GitHub Desktop.
Save ellieayla/ac890649c5b484062dedf98ae1f186ec to your computer and use it in GitHub Desktop.
kubernetes/kubernetes issue 73541
Seconds Secrets
5 2
3 3
3 4
3 5
3 6
3 7
3 8
4 9
4 10
4 11
4 12
4 13
6 14
5 15
6 16
7 17
5 18
7 19
6 20
6 21
6 22
7 23
7 24
7 25
8 26
8 27
8 28
8 29
8 30
8 31
10 32
8 33
8 34
9 35
10 36
9 37
10 38
9 39
10 40
11 41
11 42
11 43
11 44
12 45
11 46
13 47
14 48
12 49
12 50
11 51
13 52
13 53
13 54
14 55
13 56
14 57
13 58
16 59
14 60
16 61
14 62
15 63
16 64
15 65
16 66
15 67
17 68
16 69
17 70
17 71
16 72
18 73
17 74
16 75
19 76
18 77
19 78
18 79
19 80
20 81
19 82
19 83
22 84
20 85
20 86
20 87
21 88
20 89
21 90
20 91
23 92
21 93
21 94
23 95
22 96
22 97
23 98
22 99
22 100
24 101
23 102
23 103
24 104
25 105
24 106
24 107
25 108
24 109
25 110
26 111
25 112
26 113
27 114
26 115
26 116
27 117
27 118
27 119
29 120
27 121
28 122
29 123
27 124
29 125
27 126
29 127
29 128
29 129
29 130
29 131
30 132
30 133
30 134
31 135
30 136
32 137
33 138
32 139
32 140
31 141
33 142
31 143
35 144
31 145
33 146
34 147
33 148
33 149
33 150
34 151
33 152
35 153
35 154
34 155
35 156
35 157
36 158
34 159
37 160
35 161
37 162
36 163
37 164
37 165
37 166
37 167
38 168
38 169
37 170
39 171
39 172
40 173
38 174
39 175
38 176
39 177
39 178
40 179
40 180
40 181
40 182
41 183
40 184
41 185
42 186
42 187
40 188
42 189
42 190
42 191
43 192
42 193
42 194
44 195
42 196
43 197
45 198
43 199
45 200
43 201
45 202
44 203
46 204
45 205
45 206
46 207
46 208
45 209
48 210
45 211
48 212
48 213
46 214
48 215
47 216
48 217
48 218
48 219
48 220
48 221
50 222
50 223
47 224
51 225
50 226
50 227
49 228
49 229
51 230
51 231
50 232
50 233
53 234
50 235
52 236
53 237
53 238
52 239
53 240
53 241
53 242
52 243
54 244
54 245
53 246
54 247
55 248
56 249
53 250
57 251
54 252
55 253
55 254
57 255
54 256
56 257
58 258
56 259
56 260
56 261
58 262
57 263
58 264
57 265
59 266
58 267
59 268
57 269
60 270
61 271
59 272
59 273
60 274
61 275
60 276
59 277
61 278
62 279
72 280
61 281
62 282
61 283
62 284
62 285
61 286
63 287
62 288
64 289
60 290
64 291
63 292
64 293
63 294
65 295
65 296
65 297
64 298
65 299
64 300
65 301
66 302
67 303
66 304
65 305
66 306
66 307
71 308
68 309
68 310
68 311
69 312
69 313
68 314
68 315
68 316
70 317
70 318
70 319
69 320
69 321
69 322
70 323
70 324
84 325
71 326
70 327
72 328
71 329
72 330
71 331
72 332
72 333
73 334
73 335
73 336
74 337
73 338
74 339
73 340
74 341
74 342
73 343
74 344
74 345
75 346
76 347
73 348
76 349
76 350
75 351
76 352
77 353
77 354
77 355
77 356
77 357
77 358
78 359
78 360
78 361
79 362
78 363
80 364
79 365
79 366
78 367
80 368
80 369
80 370
80 371
80 372
80 373
82 374
81 375
81 376
83 377
82 378
81 379
83 380
82 381
84 382
83 383
81 384
83 385
85 386
83 387
84 388
85 389
84 390
83 391
85 392
84 393
85 394
85 395
86 396
86 397
86 398
85 399
87 400
85 401
87 402
86 403
87 404
87 405
86 406
87 407
89 408
88 409
89 410
88 411
89 412
89 413
89 414
89 415
90 416
88 417
90 418
91 419
89 420
92 421
91 422
90 423
91 424
92 425
91 426
91 427
92 428
92 429
92 430
94 431
93 432
93 433
94 434
92 435
94 436
94 437
94 438
95 439
93 440
95 441
95 442
95 443
95 444
96 445
96 446
97 447
96 448
97 449
98 450
96 451
97 452
97 453
97 454
97 455
97 456
100 457
99 458
97 459
97 460
100 461
99 462
98 463
100 464
99 465
100 466
101 467
100 468
101 469
100 470
101 471
101 472
101 473
102 474
101 475
103 476
103 477
102 478
103 479
103 480
103 481
103 482
104 483
103 484
103 485
104 486
106 487
104 488
105 489
105 490
105 491
107 492
105 493
106 494
106 495
107 496
107 497
106 498
108 499
106 500
108 501
107 502
108 503
106 504
109 505
109 506
109 507
108 508
109 509
110 510
110 511
110 512
113 513
110 514
108 515
130 516
110 517
109 518
110 519
111 520
113 521
111 522
111 523
111 524
111 525
207 526
113 527
112 528
112 529
114 530
113 531
113 532
115 533
114 534
115 535
115 536
120 537
124 538
113 540
116 541
117 542
115 543
116 544
115 546
118 547
116 548
117 549
178 550
Seconds Secrets
6 2
2 3
3 4
4 5
3 6
2 7
2 8
4 9
3 10
3 11
3 12
3 13
3 14
4 15
3 16
3 17
3 18
3 19
3 20
3 21
4 22
3 23
3 24
3 25
4 26
3 27
3 28
3 29
3 30
3 31
4 32
3 33
3 34
3 35
3 36
3 37
4 38
3 39
3 40
3 41
3 42
3 43
3 44
3 45
3 46
3 47
3 48
3 49
5 50
3 51
3 52
3 53
3 54
3 55
3 56
3 57
3 58
4 59
3 60
3 61
3 62
3 63
3 64
5 65
3 66
4 67
3 68
3 69
3 70
3 71
4 72
3 73
3 74
3 75
3 76
4 77
4 78
3 79
4 80
3 81
3 82
3 83
4 84
4 85
3 86
3 87
3 88
3 89
3 90
4 91
3 92
3 93
3 94
3 95
3 96
3 97
4 98
3 99
3 100
3 101
3 102
3 103
3 104
3 105
3 106
3 107
4 108
3 109
3 110
3 111
3 112
3 113
3 114
3 115
3 116
5 117
3 118
3 119
3 120
3 121
3 122
6 123
11 124
13 125
15 126
13 127
9 128
7 129
7 130
4 131
11 132
7 133
3 134
3 135
8 136
10 137
9 138
4 139
3 140
8 141
3 142
3 143
3 144
3 145
3 146
3 147
3 148
5 149
3 150
5 151
3 152
3 153
3 154
3 155
4 156
8 157
4 158
4 159
4 160
3 161
3 162
3 163
3 164
3 165
3 166
3 167
3 168
3 169
4 170
3 171
3 172
3 173
3 174
3 175
3 176
3 177
3 178
4 179
3 180
3 181
3 182
3 183
4 184
4 185
3 186
4 187
3 188
3 189
3 190
3 191
3 192
4 193
3 194
3 195
3 196
4 197
3 198
3 199
3 200
3 201
3 202
3 203
3 204
3 205
3 206
3 207
3 208
3 209
3 210
3 211
3 212
3 213
3 214
3 215
3 216
3 217
3 218
3 219
3 220
3 221
3 222
4 223
4 224
3 225
3 226
3 227
3 228
3 229
3 230
3 231
3 232
3 233
3 234
3 235
3 236
3 237
3 238
3 239
3 240
3 241
4 242
3 243
3 244
3 245
4 246
3 247
3 248
3 249
3 250
3 251
3 252
3 253
4 254
3 255
3 256
3 257
3 258
3 259
3 260
3 261
3 262
3 263
3 264
4 265
3 266
5 267
3 268
4 269
3 270
3 271
3 272
3 273
3 274
3 275
3 276
3 277
5 278
3 279
3 280
3 281
3 282
3 283
4 284
3 285
3 286
3 287
3 288
4 289
3 290
3 291
3 292
3 293
4 294
3 295
3 296
3 297
3 298
4 299
3 300
3 301
3 302
3 303
3 304
3 305
3 306
3 307
4 308
3 309
3 310
3 311
4 312
3 313
5 314
3 315
4 316
3 317
3 318
3 319
3 320
3 321
3 322
3 323
Seconds Secrets Pods
7 30 1
19 30 2
30 30 3
41 30 4
53 30 5
60 30 6
85 30 7
91 30 8
98 30 9
121 30 10
137 30 11
151 30 12
156 30 13
181 30 14
192 30 15
207 30 16
212 30 17
234 30 18
244 30 19
248 30 20
Seconds Secrets Pods
7 30 1
21 30 2
36 30 3
49 30 4
66 30 5
77 30 6
95 30 7
146 30 8
80 30 9
134 30 10
154 30 11
157 30 12
# Requirements
which kubectl jq date
# Reset
kubectl patch sa default -p '{"imagePullSecrets": null}' --type=merge
kubectl delete secret acr-auth
kubectl delete pod -l app=test-alpine36
current_count=0
runtime=0
# Create a secret following pattern in https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auth-aks
# The server/user/password don't matter, as we're not going to deploy any images from a private container registry
kubectl create secret docker-registry acr-auth --docker-server example.azurecr.io --docker-username example --docker-password test --docker-email me@example.com
kubectl patch sa default -p '{"imagePullSecrets":[{"name": "acr-auth"}]}' --type=merge
add_secrets() {
for I in $(seq ${1}); do
kubectl patch sa default --type='json' -p='[{"op": "add", "path": "/imagePullSecrets/-", "value": {"name": "acr-auth"}}]'
done
current_count=$(kubectl get sa default -o json | jq '.imagePullSecrets | length')
}
# Launch N pods, measure launch time
time_starting_pod() {
start=`date +%s`
for K in $(seq ${1}); do
(kubectl run -it --rm --image=alpine:3.6 --quiet=true --restart=Never -l app=test-alpine36 alpine36-${K} -- echo up > /dev/null) &
done
wait $(jobs -p)
end=`date +%s`
runtime=$((end-start))
}
# Prep; # Seed 1+29=30 secrets
add_secrets 29
# Start 1..20 pods, measure startup duration
echo "Seconds, Secrets, Pods"
for J in $(seq 20); do
time_starting_pod ${J}
echo "${runtime}, ${current_count}, ${J}"
done
Seconds Secrets
4 2
3 3
3 4
3 5
3 6
3 7
3 8
3 9
4 10
4 11
6 12
5 13
6 14
4 15
6 16
6 17
5 18
6 19
7 20
6 21
9 22
7 23
6 24
7 25
7 26
8 27
8 28
8 29
9 30
9 31
9 32
9 33
9 34
9 35
10 36
11 37
10 38
10 39
10 40
10 41
13 42
11 43
11 44
11 45
11 46
12 47
13 48
12 49
12 50
12 51
14 52
14 53
12 54
13 55
14 56
15 57
14 58
14 59
14 60
14 61
15 62
16 63
15 64
17 65
17 66
15 67
17 68
17 69
18 70
17 71
16 72
18 73
18 74
17 75
19 76
18 77
20 78
19 79
19 80
19 81
20 82
20 83
19 84
20 85
21 86
22 87
20 88
23 89
22 90
20 91
21 92
23 93
22 94
21 95
23 96
22 97
23 98
25 99
22 100
23 101
24 102
24 103
23 104
24 105
26 106
23 107
25 108
25 109
24 110
25 111
27 112
25 113
26 114
27 115
26 116
27 117
27 118
26 119
28 120
27 121
28 122
28 123
28 124
26 125
29 126
29 127
29 128
29 129
31 130
30 131
30 132
29 133
30 134
32 135
30 136
31 137
32 138
31 139
31 140
33 141
31 142
32 143
32 144
32 145
32 146
33 147
32 148
35 149
33 150
34 151
33 152
35 153
34 154
34 155
36 156
34 157
36 158
35 159
36 160
35 161
36 162
37 163
35 164
38 165
36 166
39 167
37 168
39 169
38 170
40 171
37 172
39 173
38 174
38 175
40 176
38 177
40 178
39 179
40 180
40 181
40 182
41 183
42 184
41 185
42 186
40 187
43 188
41 189
44 190
41 191
42 192
43 193
44 194
43 195
42 196
45 197
43 198
45 199
44 200
43 201
46 202
45 203
45 204
45 205
46 207
45 208
46 209
45 210
46 211
50 212
46 213
47 214
47 215
47 216
49 217
48 218
49 219
49 220
48 221
48 222
49 223
49 224
50 225
50 226
49 227
51 228
50 229
49 230
51 231
51 232
52 233
53 234
51 235
52 236
52 237
53 238
52 239
53 240
53 241
54 242
52 243
53 244
54 245
54 246
53 247
54 248
55 249
54 250
54 251
56 252
55 253
55 254
56 255
55 256
57 257
56 258
57 259
57 260
57 261
56 262
57 263
58 264
58 265
58 266
57 267
59 268
59 269
60 270
59 271
57 272
59 273
61 274
60 275
61 276
59 277
60 278
63 279
59 280
61 281
62 282
61 283
61 284
63 285
61 286
63 287
62 288
64 289
64 290
63 291
64 292
63 293
64 294
64 295
64 296
64 297
66 298
66 299
65 300
67 301
64 302
67 303
66 304
65 305
66 306
66 307
66 308
69 309
68 310
67 311
68 312
67 313
68 314
68 315
68 316
69 317
70 318
70 319
70 320
70 321
69 322
70 323
69 324
71 325
72 326
72 327
70 328
72 329
71 330
73 331
72 332
72 333
72 334
73 335
73 336
73 337
73 339
73 340
74 341
74 342
75 343
75 344
75 345
75 346
75 347
76 348
75 349
75 350
76 351
76 352
76 353
82 354
77 355
77 356
77 357
77 358
77 359
77 360
78 361
79 362
79 363
79 364
80 365
80 366
79 367
79 368
81 369
80 370
80 371
81 372
80 373
81 374
81 375
81 376
81 377
83 378
81 379
83 380
81 381
82 382
82 383
83 384
83 385
82 386
85 387
84 388
84 389
83 390
85 391
85 392
85 393
85 394
85 395
85 396
85 397
85 398
86 399
88 400
86 401
86 402
87 403
87 404
88 405
88 406
88 407
89 408
88 409
88 410
88 411
90 412
89 413
89 414
90 415
88 416
89 417
91 418
90 419
90 420
91 421
91 422
91 423
91 424
91 425
92 426
92 427
91 428
92 429
93 430
93 431
93 432
93 433
94 434
94 435
94 436
94 437
93 438
95 439
95 440
94 441
94 442
96 443
96 444
94 445
96 446
96 447
96 448
96 449
97 450
96 451
98 452
97 453
97 454
98 455
97 456
98 457
99 458
99 459
99 460
98 461
101 462
98 463
98 464
100 465
98 466
100 467
102 468
100 469
101 470
101 471
102 472
102 473
102 474
103 475
101 476
102 477
102 478
103 479
103 480
104 481
103 482
103 483
103 484
104 485
104 486
104 487
103 488
103 489
107 490
105 491
108 492
105 493
106 494
106 495
105 496
108 497
106 498
107 499
107 500
108 501
109 502
107 503
108 504
107 505
108 506
109 507
108 508
109 509
111 510
110 511
110 512
109 513
110 514
175 515
110 516
111 517
111 518
111 519
110 520
113 521
112 522
112 523
116 524
114 525
113 526
112 527
113 528
112 529
114 530
114 531
114 532
114 533
115 534
114 535
115 536
116 537
191 538
116 539
114 540
116 541
115 542
116 543
117 544
116 545
117 546
118 547
117 548
119 549
117 550
118 551
118 552
118 553
119 554
119 555
118 556
119 557
119 558
120 559
121 560
119 561
122 562
121 563
119 564
121 565
120 566
123 567
123 568
120 569
122 570
121 571
123 572
124 573
122 574
122 575
123 576
124 577
122 578
124 579
124 580
124 581
125 582
124 583
126 584
128 585
127 586
126 587
124 588
126 589
126 590
125 591
127 592
126 593
127 594
128 595
128 596
127 597
128 598
127 599
129 600
128 601
Seconds Secrets
3 2
3 3
2 4
3 5
3 6
4 7
4 8
4 9
5 10
4 11
4 12
5 13
5 14
5 15
6 16
6 17
6 18
7 19
7 20
11 21
7 22
8 23
8 24
8 25
7 26
9 27
8 28
8 29
9 30
9 31
10 32
9 33
10 34
9 35
10 36
9 37
9 38
10 39
11 40
11 41
12 42
12 43
11 44
20 45
13 46
12 47
12 48
12 49
13 50
13 51
15 52
14 53
13 54
13 55
14 56
#!/bin/bash
# Prep:
# deploy an AKS 1-node cluster with v1.11.5 on Standard DS2 v2 (2 vcpus, 7 GB memory)
# Requirements
which kubectl jq date
# Reset
kubectl patch sa default -p '{"imagePullSecrets": null}' --type=merge
kubectl delete secret acr-auth
kubectl delete pod alpine36
current_count=0
runtime=0
# Create a secret following pattern in https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auth-aks
# The server/user/password don't matter, as we're not going to deploy any images from a private container registry
kubectl create secret docker-registry acr-auth --docker-server example.azurecr.io --docker-username example --docker-password test --docker-email me@example.com
kubectl patch sa default -p '{"imagePullSecrets":[{"name": "acr-auth"}]}' --type=merge
add_secrets() {
for I in $(seq 1); do
kubectl patch sa default --type='json' -p='[{"op": "add", "path": "/imagePullSecrets/-", "value": {"name": "acr-auth"}}]' > /dev/null
done
current_count=$(kubectl get sa default -o json | jq '.imagePullSecrets | length')
}
time_starting_pod() {
start=`date +%s`
kubectl run -it --rm --image=alpine:3.6 --quiet=true --restart=Never alpine36 -- echo up > /dev/null
end=`date +%s`
runtime=$((end-start))
}
# Write 600+1 secrets.
echo "Seconds, Secrets"
for J in $(seq 600); do
time_starting_pod
add_secrets
echo "${runtime}, ${current_count}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment