├── CONTRIBUTING.md
├── LICENSE
├── README-zh_CN.md
├── README.md
├── coding
└── python
│ └── binary_search.py
├── common-qa.md
├── credits.md
├── images
├── ansible.png
├── bash.png
├── cloud.png
├── coding.png
├── devops.png
├── docker.png
├── elastic.png
├── general.png
├── git.png
├── jenkins.png
├── kubernetes.png
├── linux.png
├── mongo.png
├── monitoring.png
├── network.png
├── openshift.png
├── openstack.png
├── prometheus.png
├── puppet.png
├── python.png
├── scenarios.png
├── security.png
├── sql.png
└── terraform.png
├── prepare_for_interview.md
├── scenarios
├── ansible_minikube_docker.md
├── ci_for_open_source_project.md
├── cloud_slack_bot.md
├── elk_kibana_aws.md
├── jenkins
│ └── scripts
│ │ ├── jobs_with_string.groovy
│ │ └── old_builds.groovy
├── jenkins_pipelines.md
├── jenkins_scripts.md
├── solutions
│ └── elk_kibana_aws.md
└── write_dockerfile_run_container.md
└── scripts
└── count_questions.sh
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## How to contribute
2 |
3 | Use pull requests to contribute to the project.
4 |
5 | Stick to the following format:
6 |
7 |
8 | [Question]
9 |
10 | [Answer]
11 |
12 |
13 | ## What to avoid
14 |
15 | * Avoid adding installation questions. Those are the worst type of questions...
16 | * Don't copy questions and answers from other sources. They probably worked hard for adding them.
17 | * If you add new images, make sure they are free and can be used.
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
2 |
3 | BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
4 |
5 | 1. Definitions
6 | "Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
7 | "Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License.
8 | "Distribute" means to make available to the public the original and copies of the Work through sale or other transfer of ownership.
9 | "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
10 | "Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
11 | "Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
12 | "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
13 | "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
14 | "Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
15 |
16 | 2. Fair Dealing Rights.
17 | Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
18 |
19 | 3. License Grant.
20 | Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
21 |
22 | to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; and,
23 | to Distribute and Publicly Perform the Work including as incorporated in Collections.
24 | The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats, but otherwise you have no rights to make Adaptations. Subject to 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(d).
25 |
26 | 4. Restrictions.
27 | The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
28 |
29 | You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested.
30 | You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in connection with the exchange of copyrighted works.
31 | If You Distribute, or Publicly Perform the Work or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work. The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Collection, at a minimum such credit will appear, if a credit for all contributing authors of Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
32 | For the avoidance of doubt:
33 |
34 | Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
35 | Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and,
36 | Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b).
37 | Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation.
38 |
39 | 5. Representations, Warranties and Disclaimer
40 | UNLESS OTHERWISE MUTUALLY AGREED BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
41 |
42 | 6. Limitation on Liability.
43 | EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
44 |
45 | 7. Termination
46 | This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
47 | Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
48 |
49 | 8. Miscellaneous
50 | Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
51 | If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
52 | No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
53 | This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
54 | The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.
55 |
--------------------------------------------------------------------------------
/README-zh_CN.md:
--------------------------------------------------------------------------------
1 | # DevOps 面试问题
2 |
3 |
4 | :information_source: 本仓库包含各种 DevOps 相关主题的面试问题
5 |
6 | :bar_chart: 当前有 **413** 个问题
7 |
8 |
9 | :warning: 你不需要知道回答这个仓库的所有问题。 DevOps并不是知道一切:)
10 |
11 | :page_facing_up: 不同的面试官专注于不同的事情。 有些人将重点放在你的简历上,而另一些人可能将重点放在方案问题或特定的技术问题上。 在这个仓库,我尽力覆盖各种类型的DevOps问题,供你练习和测试你的知识
12 |
13 | :pencil: 你可以通过PR来添加更多问题和答案:)
14 |
15 | ****
16 |
17 |
18 |
19 |
20 |
21 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | ## DevOps
60 |
61 |
62 | #### 初级
63 |
64 |
65 | 什么是 DevOps? DevOps 帮助我们完成什么?
66 |
67 |
68 |
69 | DevOps 的反模式是什么?
70 |
71 |
72 |
73 | 什么是持续集成?
74 |
75 | 开发人员经常将代码集成到共享仓库中的一种开发实践。 它的范围可以从每天或每周进行几次更改,到大规模在一个小时内进行几次更改。
76 |
77 | 验证每段代码(更改/补丁),以使更改可以安全地合并。 如今,使用自动构建来确保代码可以集成的测试更改是一种常见的做法。 它可以是一个运行在不同级别(单元,功能等)的多个测试的构建,也可以是所有或某些必须通过以将更改合并到存储库中的多个单独的构建。
78 |
79 |
80 |
81 | 什么是持续部署?
82 |
83 |
84 |
85 | 什么是持续交付?
86 |
87 |
88 |
89 | 你认为CI / CD的最佳做法是什么?
90 |
91 |
92 |
93 | 你将用于以下哪些系统和/或工具?:
94 |
95 |
96 | * CI/CD
97 | * 基础架构
98 | * 配置管理
99 | * 监控 & 报警
100 | * 日志
101 | * 代码审查
102 | * 代码覆盖率
103 | * 测试集
104 | * CI/CD - Jenkins, Circle CI, Travis
105 | * 基础架构 - Terraform, CloudFormation
106 | * 配置管理 - Ansible, Puppet, Chef
107 | * 监控 & 报警 - Prometheus, Nagios
108 | * 日志 - Logstash, Graylog, Fluentd
109 | * 代码审查 - Gerrit, Review Board
110 | * 代码覆盖率 - Cobertura, Clover, JaCoCo
111 | * 测试集 - Robot, Serenity, Gauge
112 |
113 |
114 |
115 | 你在选择工具/技术时是怎么考虑的?
116 |
117 | 你可以使用以下一项或全部:
118 | * 成熟与尖端
119 | * 社区规模
120 | * 体系结构方面-代理与无代理,主控与无主控等
121 |
122 |
123 |
124 | 解释可变基础架构与不变基础架构
125 |
126 | 在可变的基础架构原则中,更改将应用到现有基础架构之上并随着时间的推移而变化
127 | 基础架构建立了变化的历史。 Ansible,Puppet和Chef这些工具
128 | 遵循可变的基础架构原则。
129 |
130 | 在不变的基础架构原则中,每项更改实际上都是新的基础架构。 所以改变
131 | 到服务器将导致新服务器而不是更新服务器。 Terraform是
132 | 遵循不变的基础架构原则的一个例子。
133 |
134 |
135 |
136 | 你熟悉什么方式来交付软件?
137 | * 存档 - 将你所有的应用文件收集到一个存档中(例如tar),并将其交付给用户。
138 | * 打包 - 取决于操作系统,你可以使用OS软件包格式(例如,在RHEL / Fefodra中为RPM)来交付软件,并使用标准打包程序命令来安装,卸载和更新它
139 | * 映像 - VM或容器映像,其中包已包含在其中,以便成功运行。
140 |
141 |
142 |
143 | 什么是缓存? 缓存是怎么工作的? 为什么缓存很重要?
144 |
145 |
146 |
147 | 解释一下无状态和有状态
148 |
149 |
150 |
151 | 什么是HTTP及其工作方式?
152 |
153 |
154 |
155 | 描述一下设置某些类型的Web服务器的工作流程 (Apache, IIS, Tomact, ...)
156 |
157 |
158 |
159 | 解释一下监控. 它是什么? 为什么监控是重要的?
160 |
161 |
162 |
163 | 你熟悉那些监控方法?
164 |
165 |
166 |
167 | #### 高级
168 |
169 |
170 | 告诉我你是如何执行CI / CD资源的计划容量 (如服务器, 存储, 等等.)
171 |
172 |
173 |
174 | 你将如何为依赖于其他多个应用程序的应用程序构建/实现CD?
175 |
176 |
177 |
178 | 你如何衡量CI / CD的质量? 有那些你正在使用的指标吗?
179 |
180 |
181 |
182 | 什么是配置漂移? 它引起什么问题?
183 |
184 | 当配置和软件完全相同的服务器环境中的某个服务器上发生配置漂移
185 | 或服务器正在应用其他服务器无法获得的更新或配置,并且随着时间的推移,这些服务器将变为
186 | 略有不同。
187 |
188 | 这种情形可能会导致难以识别和重现的错误。
189 |
190 |
191 |
192 | 怎样处理配置漂移?
193 |
194 |
195 |
196 | 你是否有跨项目变更测试的经验? (又名交叉依赖)
197 |
198 | 注意:交叉依赖是指你对单独的项目进行了两个或多个更改,并且你希望在相互构建中对其进行测试,而不是分别测试每个更改。
199 |
200 |
201 |
202 | 在哪种情况下,你希望使用SQL?
203 | * 同类数据,预计不会发生变化
204 | * ACID合规性很重要
205 |
206 |
207 |
208 | ## Jenkins
209 |
210 |
211 | #### 初级
212 |
213 |
214 | 什么是 Jenkins? 你用它来做什么?
215 |
216 |
217 |
218 | 相比其他的竞争者 jenkins 有什么优势? 你能把jenkins 和下面的系统做一个比较吗?:
219 |
220 | * Travis
221 | * Bamboo
222 | * Teamcity
223 | * CircleCI
224 |
225 |
226 |
227 | 解释以下:
228 |
229 | * Job
230 | * Build
231 | * Plugin
232 | * Slave
233 | * Executor
234 |
235 |
236 |
237 | 你在 Jenkins 用过什么插件?
238 |
239 |
240 |
241 | 解释一下 CI/CD 你在 Jenkins 是怎么实现他们的
242 |
243 |
244 |
245 | 有什么类型的工作? 你使用了哪些类型,为什么?
246 |
247 |
248 |
249 | 你如何向用户报告构建结果? 你熟悉什么那些方式?
250 |
251 |
252 |
253 | 每次有更改提交,你都需要运行单元测试。 详细描述管道的环境以及每个阶段将执行的操作
254 |
255 |
256 |
257 | 怎样保护 Jenkins?
258 |
259 |
260 |
261 | 你能描述一些 Jenkins 最佳实践吗?
262 |
263 |
264 |
265 | #### 高级
266 |
267 |
268 | 如何为一个特定的构建获取多个从属?
269 |
270 |
271 |
272 | 你的组织中有四个团队。 如何优先考虑每个团队的建设? 例如,x团队的工作将始终在y团队之前运行
273 |
274 |
275 |
276 | 你有部署 Jenkins 插件的经验吗? 你能描述一下吗?
277 |
278 |
279 |
280 | 如果你要管理许多工作,你可能使用Jenkins UI。 你如何每周/每月管理数百个作业的创建和删除?
281 |
282 |
283 |
284 | Jenkins 有那些限制?
285 |
286 | * 测试交叉依赖关系(来自多个项目的变更)
287 | * 从任何阶段开始构建(尽管cloudbees实现了称为检查点的东西)
288 |
289 |
290 |
291 | 你是如何实施从某个阶段而不是从最开始构建的选项?
292 |
293 |
294 |
295 | 你曾经写过 Jenkins 脚本吗? 如果有,有哪些? 分别是怎么样工作的?
296 |
297 |
298 | ## Cloud
299 |
300 |
301 | #### 初级
302 |
303 |
304 | 云计算的优势是什么? 至少列出3个优势
305 |
306 |
307 |
308 | 他们分别是那种类型的云计算?
309 |
310 | IAAS
311 | PAAS
312 | SAAS
313 |
314 |
315 |
316 | 解释一下以下云计算部署:
317 |
318 | * Public
319 | * Hybrid
320 | * Private
321 |
322 |
323 |
324 | ## AWS
325 |
326 |
327 | #### 初级
328 |
329 | ##### 全局基础设施
330 |
331 |
332 | 解释以下
333 |
334 | * 可用区
335 | * 区域
336 | * 边缘位置
337 |
338 |
339 | AWS区域是遍布全球不同地理位置的数据中心,每个区域彼此完全独立。
340 | 在每个区域内,有多个隔离的位置,称为可用区。 多个可用区可确保其中之一发生故障时具有高可用性。
341 |
342 | 边缘位置基本上是内容传递网络,它缓存数据并确保较低的延迟和更快地传递给任何位置的用户。 他们位于世界主要城市。
343 |
344 |
345 |
346 | ##### S3
347 |
348 |
349 | 解释一下什么是S3,以及它用来干嘛
350 |
351 | S3代表3 S(Simple Storage Service)。
352 | S3是一种对象存储服务,它是快速,可伸缩和持久的。 S3使客户能够上传,下载或存储最大5 TB的文件或对象。 同时每个文件的最大大小为5 GB(如果大小超过5 GB,则分段上传)。
353 |
354 |
355 |
356 |
357 | 什么是存储桶?
358 | S3存储桶是一种资源,类似于文件系统中的文件夹,并且允许存储由数据及其元数据组成的对象。
359 |
360 |
361 |
362 | 对还是错? 存储桶必须全局唯一
363 | True
364 |
365 |
366 |
367 | S3 中 包含哪些对象 ?
368 | * 另一种问法: 在对象上下文中解释键,值,版本ID和元数据
369 |
370 |
371 |
372 | 解释一下数据一致性
373 |
374 |
375 |
376 | 你可以在s3上托管动态网站吗? 静态网站呢?
377 |
378 |
379 |
380 | 你在S3上下文中采取了哪些安全措施?
381 |
382 |
383 | ##### CloudFront
384 |
385 |
386 | 解释一下什么是CloudFront及其用途
387 |
388 |
389 |
390 | 解释以下
391 | * 域
392 | * 边缘位置
393 | * 分布
394 |
395 |
396 |
397 | CDN用户可以使用哪些交付方式?
398 |
399 |
400 |
401 | 对还是错? 在TTL的生命周期内缓存对象
402 |
403 |
404 |
405 | ##### EC2
406 |
407 |
408 | 你创建了哪种类型的实例?
409 |
410 |
411 |
412 | 如何为给定的EC2实例增加RAM?
413 |
414 | 停止实例,使其实例类型与所需的RAM匹配,然后启动实例。
415 |
416 |
417 |
418 | 什么是 AMI?
419 |
420 |
421 |
422 | EC2实例有多少个存储选项?
423 |
424 |
425 |
426 | EC2实例停止或终止时会发生什么?
427 |
428 |
429 |
430 | 什么是安全组?
431 |
432 |
433 |
434 |
435 | 如何将实例迁移到另一个可用性区域?
436 |
437 |
438 |
439 |
440 | 什么是安全组?
441 |
442 |
443 |
444 |
445 | 什么是竞价型实例?
446 |
447 |
448 |
449 | ## 网络
450 |
451 |
452 | #### 初级
453 |
454 |
455 | 什么是以太网?
456 |
457 |
458 |
459 | 什么是一个 MAC 地址? 它用来干嘛?
460 |
461 |
462 |
463 | 什么时候这个 MAC 地址会被用来使用?: ff:ff:ff:ff:ff:ff
464 |
465 |
466 |
467 | 什么是一个 IP 地址? 什么是子网?
468 |
469 |
470 |
471 | 解释一下 OSI 模型. 有那些层? 每层负责什么?
472 |
473 |
474 | 应用层:用户端(HTTP在这一层)
475 | 表示层:在应用程序层实体之间建立上下文(加密在这一层)
476 | 会话层:建立,管理和终止连接
477 | 传输层:将可变长度的数据序列从源传输到目标主机(TCP和UDP在这一层)
478 | 网络层:将数据报从一个网络传输到另一个网络(IP 层在这里)
479 | 数据链接层:提供两个直接连接的节点之间的链接(MAC在这一层)
480 | 物理层:数据连接的电气和物理规格(比特在这一一层)
481 |
482 |
483 |
484 | 你熟悉哪些传送方案?
485 | 单位广播:一对一通信,其中有一个发送方和一个接收方。
486 |
487 | 广播:向网络中的所有人发送消息。 地址ff:ff:ff:ff:ff:ff:ff用于广播。
488 | 使用广播的两个常见协议是ARP和DHCP。
489 |
490 | 组播:向一组订户发送消息。 它可以是一对多或多对多。
491 |
492 |
493 |
494 | 什么是 CSMA/CD? 在现代以太网中有使用吗?
495 |
496 | CSMA / CD代表载波侦听多路访问/冲突检测。
497 | 它的主要重点是管理对共享媒体/总线的访问,在该共享媒体/总线上,在给定的时间点只能传输一个主机。
498 |
499 | CSMA / CD算法:
500 |
501 | 1. 在发送帧之前,它会检查其他主机是否已经在发送帧。
502 | 2. 如果没有人发送,它将开始发送帧。
503 | 3. 如果两个主机同时传输,则发生冲突。
504 | 4. 双方主机均停止发送帧,并向每个人发送“干扰信号”,通知每个人发生冲突
505 | 5. 他们正在等待随机时间,然后再次发送
506 | 6. 一旦每个主机等待一段随机时间,他们就会尝试再次发送帧
507 |
508 |
509 |
510 | 描述以下网络设备及其之间的区别:
511 |
512 | * 路由器
513 | * 交换机
514 | * 集线器
515 |
516 |
517 |
518 | 什么是 NAT?
519 |
520 |
521 |
522 | TCP 和 UDP 两者之间有那些区别?
523 |
524 |
525 |
526 | TCP 是怎样工作的? 什么是 3 次握手?
527 |
528 |
529 |
530 | 什么是 ARP? 它是怎么工作的?
531 |
532 |
533 |
534 | 什么是 TTL?
535 |
536 |
537 |
538 | 什么是DHCP? 它是怎么工作的?
539 |
540 |
541 |
542 | 什么是SSL 隧道? 它是怎么工作的?
543 |
544 |
545 |
546 | 什么是套接字? 在哪里可以看到系统中的套接字列表?
547 |
548 |
549 |
550 | 什么是IPv6? 如果我们拥有IPv4,为什么要考虑使用它?
551 |
552 |
553 |
554 | 什么是VLAN?
555 |
556 |
557 |
558 | 什么是MTU?
559 |
560 |
561 |
562 | 什么是SDN?
563 |
564 |
565 |
566 | 什么是ICMP? 它有什么用途?
567 |
568 |
569 |
570 | 什么是NAT? 它是怎么工作的?
571 |
572 |
573 |
574 | #### 高级
575 |
576 |
577 | 解释一下生成树协议 (STP)
578 |
579 |
580 |
581 | 什么是链路聚合? 为什么使用它?
582 |
583 |
584 |
585 | 什么是非对称路由? 怎样处理它?
586 |
587 |
588 |
589 | 你熟悉哪些叠加(隧道)协议?
590 |
591 |
592 |
593 | 什么是GRE? 它是怎么工作的?
594 |
595 |
596 |
597 | 什么是VXLAN? 它是怎么工作的?
598 |
599 |
600 |
601 | 什么是SNAT?
602 |
603 |
604 |
605 | 解释一下 OSPF
606 |
607 |
608 |
609 | 解释一下 Spine & Leaf
610 |
611 |
612 |
613 | 使用海明码, 100111010001101 会编码成什么码?
614 |
615 | 00110011110100011101
616 |
617 |
618 | ## Linux
619 |
620 |
621 | #### 初级
622 |
623 |
624 | 你有那些 Linux 经验? 当你可以在多个操作系统上设置应用程序时,你希望在哪个操作系统上进行设置以及为什么?
625 |
626 |
627 |
628 | 解释以下每个命令的作用,并举例说明如何使用它
629 |
630 | * ls
631 | * rm
632 | * rmdir (你能使用 rm
完成同样的结果吗?)
633 | * grep
634 | * wc
635 | * curl
636 | * touch
637 | * man
638 | * nslookup or dig
639 | * df
640 |
641 |
642 |
643 | 运行命令 df
你会得到 "找不到命令". 可能出现什么问题以及如何修复它?
644 |
645 |
646 |
647 | 如何确保服务将在你选择的操作系统上启动?
648 |
649 |
650 |
651 | 你如何定期安排任务?
652 |
653 | 你能使用命令 cron
和 at
.
654 | 对于cron,使用以下格式安排任务:
655 |
656 |
657 |
658 | 任务存储在cron文件中。
659 |
660 |
661 |
662 | 你过去是否安排了任务? 什么样的任务?
663 |
664 | 通常,你将安排批处理作业。
665 |
666 |
667 |
668 | ##### 权限
669 |
670 |
671 | 怎样改变一个文件的权限?
672 |
673 | 使用 `chmod` 命令.
674 |
675 |
676 |
677 |
678 | 下面的权限意味着什么?:
679 |
680 | * 777
681 | * 644
682 | * 750
683 |
684 | 777 - 所有人有读和写和可执行权限(意味着你很懒)
685 | 644 - 拥有者有读和写的权限、其他人只有读权限
686 | 750 - 拥有者有所有权限, 组成员可以读和执行权限、其他人没有权限
687 |
688 |
689 |
690 | 解释一下什么是setgid, setuid 和 sticky bit
691 |
692 |
693 |
694 | 如何在不向其提供登录系统功能的情况下将新用户添加到系统?
695 |
696 | * adduser user_name --shell=/bin/false --no-create-home
697 |
698 |
699 |
700 |
701 | 在使用systemd的系统上,如何显示日志?
702 |
703 | * journalctl
704 |
705 |
706 |
707 | ##### 调试
708 |
709 |
710 | 你正在使用什么进行故障排除和调试 网络 问题?
711 |
712 | dstat -t
非常适合辨别网络和磁盘问题。
713 | netstat -tnlaup
可用于查看哪些进程在哪些端口上运行。
714 | lsof -i -P
可以用于与netstat相同的目的。
715 | ngrep -d any metafilter
用于将正则表达式与数据包的载荷相匹配。
716 | tcpdump
用于捕获数据包
717 | wireshark
与tcpdump相同的概念,但带有GUI(可选)。
718 |
719 |
720 |
721 | 你正在使用什么进行故障排除和调试 磁盘 & 文件系统 问题?
722 |
723 | dstat -t
非常适合辨别网络和磁盘问题。
724 | opensnoop
可以用来查看正在系统上打开哪些文件(实时)。
725 |
726 |
727 |
728 | 你正在使用什么进行故障排除和调试 进程 问题?
729 |
730 | strace
非常适合了解你的程序的功能。 它打印你的程序执行的每个系统调用。
731 |
732 |
733 |
734 | 你正在使用什么来调试CPU相关问题?
735 |
736 | top
显示每个进程消耗多少CPU占比
737 | perf
是采样分析器的理想选择,通常来说,找出哪些CPU周期被“浪费”了
738 | flamegraphs
非常适合CPU消耗可视化(http://www.brendangregg.com/flamegraphs.html)
739 |
740 |
741 |
742 | 你收到一个电话,说“我的系统运行缓慢” - 你将如何处理?
743 |
744 | 1. 使用top
检查是否有任何资源消耗你的CPU或RAM。
745 | 2. 运行dstat -t
来检查它是否与磁盘或网络有关。
746 | 3. 使用iostat
检查 I/O 统计信息
747 |
748 |
749 |
750 | 什么是Linux内核模块以及如何加载新模块?
751 |
752 |
753 |
754 | 什么是KVM?
755 |
756 |
757 |
758 | SSH和SSL之间的区别是什么?
759 |
760 |
761 |
762 | SSH端口转发是什么?
763 |
764 |
765 |
766 | 解释重定向
767 |
768 |
769 |
770 | 什么是通配符? 你能举一个使用它们的例子吗?
771 |
772 |
773 |
774 | 我们在以下每个命令中使用grep做什么?
775 |
776 | * grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' some_file
777 | * grep -E "error|failure" some_file
778 | * grep '[0-9]$' some_file
779 |
780 |
781 | 1. 一个 IP 地址
782 | 2. 单词 "error" 或 "failure"
783 | 3. 以数字结尾的行
784 |
785 |
786 |
787 | 告诉我你了解所有有关Linux启动过程的知识
788 |
789 |
790 |
791 | 什么是退出码? 你熟悉那些退出码?
792 |
793 | 退出码(或返回码)表示子进程返回其父进程的码。
794 |
795 | 0是退出码,表示成功,而大于1的码表示错误。
796 | 每个数字都有不同的含义,具体取决于应用程序的开发方式。
797 |
798 | 我认为这是一篇可以了解更多的好博客:https://shapeshed.com/unix-exit-codes
799 |
800 |
801 |
802 | 软链接和硬链接之间的区别是什么?
803 |
804 | 硬链接是使用相同inode的相同文件。
805 | 软链接是使用不同inode的另一个文件的快捷方式。
806 |
807 | 可以在不同的文件系统之间创建软链接,而硬链接只能在同一文件系统内创建。
808 |
809 |
810 |
811 | 什么是交换分区? 它用来做什么的?
812 |
813 |
814 |
815 | 你试图创建一个新文件,但显示“文件系统已满”。 你使用df检查是否有可用空间,你看到还有20%的空间。 可能是什么问题?
816 |
817 |
818 |
819 | 你对LVM有什么了解?
820 |
821 |
822 |
823 | 解释以下关于LVM:
824 |
825 | * PV
826 | * VG
827 | * LV
828 |
829 |
830 |
831 | RAID用于什么用途? 你能否解释RAID 0、1、5和10之间的区别?
832 |
833 |
834 |
835 | 什么是懒卸载?
836 |
837 |
838 |
839 | 修复以下命令:
840 |
841 | * sed "s/1/2/g' /tmp/myFile
842 | * find . -iname \*.yaml -exec sed -i "s/1/2/g" {} ;
843 |
844 |
845 |
846 | 解释以下每个路径中存储的内容以及是否有一些独特之处
847 |
848 | * /tmp
849 | * /var/log
850 | * /bin
851 | * /proc
852 | * /usr/local
853 |
854 |
855 |
856 | 你能在 /etc/services 找到什么
857 |
858 |
859 |
860 | 什么是 chroot?
861 |
862 |
863 | ##### 进程
864 |
865 |
866 | 如何在后台运行进程以及为什么要优先运行?
867 |
868 | 你可以通过在命令末尾指定&来实现。至于为什么,因为一些命令/过程会占用大量的时间来完成执行或永远运行
869 |
870 |
871 |
872 | 你如何查找特定进程占用的内存量?
873 |
874 |
875 |
876 | 运行“ kill”时使用什么信号 '?
877 |
878 | 默认信号为SIGTERM(15)。 该信号可以优雅地终止进程,这意味着它可以保存当前状态配置。
879 |
880 |
881 |
882 | 你熟悉哪些信号?
883 |
884 | SIGTERM - 终止进程的默认信号
885 | SIGHUP - 常用用法是重新加载配置
886 | SIGKILL - 不能捕获或忽略的信号
887 |
888 | 运行 `kill -l` 查看所有可用的信号
889 |
890 |
891 |
892 | 什么是 trap?
893 |
894 |
895 |
896 | 当你按下Ctrl + C会发生什么?
897 |
898 |
899 |
900 | 什么是守护程序?
901 |
902 |
903 |
904 | Linux中进程的可能状态是什么?
905 |
906 | Running(运行态)
907 | Waiting (等待态))
908 | Stopped(暂停态)
909 | Terminated(终止态)
910 | Zombie(假死态)
911 |
912 |
913 |
914 | 什么是僵尸进程? 你是如何避免的?
915 |
916 |
917 |
918 | 什么是初始进程?
919 |
920 |
921 |
922 | 如何更改进程的优先级? 你为什么想这么做?
923 |
924 |
925 |
926 | 你能解释一下网络进程/连接如何建立以及如何终止?>
927 |
928 |
929 |
930 | 什么是系统调用? 你熟悉哪些系统调用?
931 |
932 |
933 |
934 | strace
做什么的?
935 |
936 |
937 |
938 | 查找所有以“ .yml”结尾的文件,并替换每个文件中的2分之一的数字
939 |
940 | ind /some_dir -iname \*.yml -print0 | xargs -0 -r sed -i "s/1/2/g"
941 |
942 |
943 |
944 | 如何查看系统有多少可用内存? 如何检查每个进程的内存消耗?
945 |
946 | 你可以使用命令top
和 free
947 |
948 |
949 |
950 | 你如何将一个50行的文件拆分为两个25行的文件?
951 |
952 | 你可以使用 split
命令就像这样split -l 25 some_file
953 |
954 |
955 |
956 | 什么是文件描述符? 你熟悉那些文件描述符?
957 | Kerberos
958 | 文件描述符,也称为文件处理程序,是一个唯一的编号,用于标识操作系统中的打开文件。
959 |
960 | 在 Linux (和 Unix) 前三个描述符是:
961 | * 0 - 输入的默认数据流
962 | * 1 - 输出的默认数据流
963 | * 2 - 与错误相关的输出的默认数据流
964 |
965 | 这有一篇好的文章关于这个主题的: https://www.computerhope.com/jargon/f/file-descriptor.htm
966 |
967 |
968 |
969 | 什么是 inode?
970 |
971 | Linux中的每个文件(和目录)都有一个索引节点,即与文件相关的存储元数据信息的数据结构
972 | ,例如文件的大小,所有者,权限等。
973 |
974 |
975 |
976 | 如何列出活动的网络连接?
977 |
978 |
979 |
980 | 什么是NTP? 它是用来干什么的?
981 |
982 |
983 |
984 | 什么是SELiunx?
985 |
986 |
987 |
988 | 什么是Kerberos?
989 |
990 |
991 |
992 | 什么是nftables?
993 |
994 |
995 |
996 | firewalld守护程序负责什么?
997 |
998 |
999 | ##### Network
1000 |
1001 |
1002 | 什么是网络名称空间? 它用来干什么的?
1003 |
1004 |
1005 |
1006 | 你如何将Linux服务器变成路由器?
1007 |
1008 |
1009 |
1010 | 什么是路由表? 你是怎样查看它的?
1011 |
1012 |
1013 |
1014 | 什么是数据包嗅探器? 你过去曾经使用过吗? 如果是,你使用了哪些数据包嗅探器以及用于什么目的?
1015 |
1016 |
1017 | ##### DNS
1018 |
1019 |
1020 | 文件 /etc/resolv.conf
用来做什么的? 它包含那些内容?
1021 |
1022 |
1023 |
1024 | 什么是 "A record"?
1025 |
1026 |
1027 |
1028 | 什么是 PTR 记录?
1029 |
1030 | A记录将域名指向IP地址,而PTR记录则相反,并将IP地址解析为域名。
1031 |
1032 |
1033 |
1034 | 什么是 MX 记录?
1035 |
1036 |
1037 |
1038 | DNS是使用TCP还是UDP?
1039 |
1040 |
1041 | ##### Packaging
1042 |
1043 |
1044 | 你有打包经验吗? 你能解释一下它是怎么工作的
1045 |
1046 |
1047 |
1048 | RPM: 解释特定格式(应包括什么内容)
1049 |
1050 |
1051 |
1052 | 你如何列出包内容?
1053 |
1054 |
1055 |
1056 | #### 高级
1057 |
1058 |
1059 | 当你执行 ls
发生了什么? 提供一个详细的答案
1060 |
1061 |
1062 |
1063 | 你能描述流程的创建方式吗?
1064 |
1065 |
1066 |
1067 | 以下块做什么?:
1068 |
1069 | ```
1070 | open("/my/file") = 5
1071 | read(5, "file content")
1072 | ```
1073 |
1074 |
1075 | 系统调用正在读 /my/file
文件 以及 5 是文件描述符数字.
1076 |
1077 |
1078 |
1079 | 进程和线程的区别是什么?
1080 |
1081 |
1082 | ##### Network
1083 |
1084 |
1085 | 当你运行 ip a
你看到一个设备叫做 'lo'. 它是什么以及为什么我们需要它?
1086 |
1087 |
1088 |
1089 | traceroute
命令做什么的? 它是怎么工作的?
1090 |
1091 |
1092 |
1093 | 什么是网络绑定? 你熟悉什么类型?
1094 |
1095 |
1096 |
1097 | 如何链接两个单独的网络名称空间,以便你可以从另一个命名空间ping一个命名空间上的接口?
1098 |
1099 |
1100 |
1101 | 什么是cgroup? 在什么情况下你会使用它们?
1102 |
1103 |
1104 |
1105 | 如何创建一定大小的文件?
1106 |
1107 | 这有一些方式去做:
1108 |
1109 | * dd if=/dev/urandom of=new_file.txt bs=2MB count=1
1110 | * truncate -s 2M new_file.txt
1111 | * fallocate -l 2097152 new_file.txt
1112 |
1113 |
1114 |
1115 | 以下系统调用之间有什么区别?: exec(), fork(), vfork() and clone()?
1116 |
1117 |
1118 |
1119 | 解释流程描述符和任务结构
1120 |
1121 |
1122 |
1123 | 线程和进程之间有什么区别?
1124 |
1125 |
1126 |
1127 | 解释内核线程
1128 |
1129 |
1130 |
1131 | 使用套接字系统调用时会发生什么?
1132 |
1133 | 这有一篇好的文章关于这个主题的: https://ops.tips/blog/how-linux-creates-sockets
1134 |
1135 |
1136 |
1137 | ## Ansible
1138 |
1139 |
1140 | #### 初级
1141 |
1142 |
1143 | 在Ansible中描述以下每个组件,包括它们之间的关系:
1144 |
1145 | * Task
1146 | * Module
1147 | * Play
1148 | * Playbook
1149 | * Role
1150 |
1151 | 任务 – 调用特定的Ansible模块
1152 | 模块 – Ansible在你自己的主机或远程主机上执行的实际代码单元。 模块按类别(数据库,文件,网络等)编制索引,也称为任务插件。
1153 |
1154 | Play – 在给定主机上执行的一个或多个任务
1155 |
1156 | Playbook – 一个或多个Play。 每个Play可以在相同或不同的主机上执行
1157 |
1158 | 角色 – Ansible角色使你可以基于某些功能/服务对资源进行分组,以便可以轻松地重用它们。 在角色中,你具有变量,默认值,文件,模板,处理程序,任务和元数据的目录。 然后,你只需在剧本中指定角色即可使用该角色。
1159 |
1160 |
1161 |
1162 | 你熟悉哪些Ansible最佳做法? 至少列出 3 条
1163 |
1164 |
1165 |
1166 | 什么是清单文件以及如何定义一个?
1167 |
1168 | 清单文件定义了在其上执行Ansible任务的主机和/或主机组。
1169 |
1170 | 一个清单文件的例子
1171 |
1172 | 192.168.1.2
1173 | 192.168.1.3
1174 | 192.168.1.4
1175 |
1176 | [web_servers]
1177 | 190.40.2.20
1178 | 190.40.2.21
1179 | 190.40.2.22
1180 |
1181 |
1182 |
1183 | 什么是动态清单文件? 什么时候使用?
1184 |
1185 | 动态清单文件可跟踪来自一个或多个来源(例如云提供商和CMDB系统)的主机。
1186 |
1187 | 应该使用当使用外部源时,尤其是在环境中的主机正在自动启动和关闭,而无需跟踪这些源中的所有更改。
1188 |
1189 |
1190 |
1191 | 你只想在特定的次要操作系统上运行Ansible Play,你将如何实现?
1192 |
1193 |
1194 |
1195 | 写任务创建目录 ‘/tmp/new_directory’
1196 |
1197 | ```
1198 | - name: Create a new directory
1199 | file:
1200 | path: "/tmp/new_directory"
1201 | state: directory
1202 | ```
1203 |
1204 |
1205 |
1206 | 接下来的Play会有什么结果?
1207 |
1208 | ```
1209 | ---
1210 | - name: Print information about my host
1211 | hosts: localhost
1212 | gather_facts: 'no'
1213 |
1214 | tasks:
1215 | - name: Print hostname
1216 | debug:
1217 | msg: "It's me, {{ ansible_hostname }}"
1218 | ```
1219 |
1220 | 提供完成的代码后,请始终进行彻底检查。 如果你的回答是“这将失败”,那么你是对的。 我们正在使用一个事实(ansible_hostname),
1221 | 这是我们正在运行的主机上收集到的信息。 但是在这种情况下,我们禁用了事实收集(gather_facts:no),因此该变量将是未定义的,这将导致失败。
1222 |
1223 |
1224 |
1225 | 如果系统上存在文件 "/tmp/mario",则编写 playbook 以在所有主机上安装 "zlib" 和 "vim" .
1226 |
1227 | ```
1228 | ---
1229 | - hosts: all
1230 | vars:
1231 | mario_file: /tmp/mario
1232 | package_list:
1233 | - 'zlib'
1234 | - 'vim'
1235 | tasks:
1236 | - name: Check for mario file
1237 | stat:
1238 | path: "{{ mario_file }}"
1239 | register: mario_f
1240 |
1241 | - name: Install zlib and vim if mario file exists
1242 | become: "yes"
1243 | package:
1244 | name: "{{ item }}"
1245 | state: present
1246 | with_items: "{{ package_list }}"
1247 | when: mario_f.stat.exists
1248 | ```
1249 |
1250 |
1251 |
1252 |
1253 | 编写一个 playbook ,将文件 "/tmp/system_info" 部署到除控制器组之外的所有主机上,并具有以下内容:
1254 |
1255 | ```
1256 | 我是 我的操作系统是
1257 | ```
1258 |
1259 | 替换 和 以及正在运行的特定主机的实际数据 The playbook 部署system_info文件
1260 |
1261 | ```
1262 | ---
1263 | - name: Deploy /tmp/system_info file
1264 | hosts: all:!controllers
1265 | tasks:
1266 | - name: Deploy /tmp/system_info
1267 | template:
1268 | src: system_info.j2
1269 | dest: /tmp/system_info
1270 | ```
1271 |
1272 | The content of the system_info.j2 template
1273 |
1274 | ```
1275 | # {{ ansible_managed }}
1276 | I'm {{ ansible_hostname }} and my operating system is {{ ansible_distribution }
1277 | ```
1278 |
1279 |
1280 |
1281 |
1282 | 变量 "whoami" 在以下位置定义:
1283 |
1284 | * 角色默认设置 -> whoami: mario
1285 | * 额外的变量(使用 -e 传递给Ansible CLI的变量)-> whoami: toad
1286 | * 托管事实 -> whoami: luigi
1287 | * 广告资源变量(与哪种类型无关)-> whoami: browser
1288 |
1289 | 根据可变优先级,将使用哪个?
1290 |
1291 |
1292 | 正确的答案是 ‘toad’。
1293 |
1294 | 变量优先级是关于变量在不同位置设置时如何相互覆盖的。 如果你到目前为止还没有体验过,我相信你会在某个时候确定的,这使它成为一个有用的话题。
1295 |
1296 | 在我们的问题上下文中,顺序将是额外的var(始终覆盖任何其他变量)-> 主机事实 -> 库存变量 -> 角色默认值(最弱)。
1297 |
1298 | 完整的列表可以在上面的链接中找到。 另外,请注意Ansible 1.x和2.x之间存在显着差异。
1299 |
1300 |
1301 |
1302 | 对于以下每个语句,确定对还是错:
1303 |
1304 | * 模块是任务的集合
1305 | * 最好使用shell或命令而不是特定的模块
1306 | * 主机事实会覆盖 play 变量
1307 | * 角色可能包括以下内容:var,meta 和 handler
1308 | * 通过从外部来源提取信息来生成动态清单
1309 | * 最佳做法是使用2个空格而不是4个缩进
1310 | * 用来触发处理程序的“通知”
1311 | * "hosts:all:!controllers"表示 "仅在控制器组主机上运行
1312 |
1313 |
1314 |
1315 |
1316 | 什么是ansible-pull? 与ansible-playbook相比有何不同?
1317 |
1318 |
1319 |
1320 |
1321 | #### 高级
1322 |
1323 |
1324 | 什么是过滤器? 你有写过滤器的经验吗?
1325 |
1326 |
1327 |
1328 | 编写过滤器来转化字符串大写
1329 |
1330 |
1331 | def cap(self, string):
1332 | return string.capitalize()
1333 |
1334 |
1335 |
1336 |
1337 | 你如何测试基于Ansible的项目?
1338 |
1339 |
1340 |
1341 | 什么是回调插件? 使用回调插件可以实现什么?
1342 |
1343 |
1344 |
1345 | ## Terraform
1346 |
1347 |
1348 | #### 初级
1349 |
1350 |
1351 | 你能解释一下什么是Terraform? 它是怎么工作的?
1352 |
1353 | 读 [这里](https://www.terraform.io/intro/index.html#what-is-terraform-)
1354 |
1355 |
1356 |
1357 | 什么使基础架构代码受益?
1358 |
1359 | - 供应,修改和删除基础架构的全自动过程
1360 | - 基础结构的版本控制,可让你快速回滚到以前的版本
1361 | - 通过自动化测试和代码审查来验证基础架构的质量和稳定性
1362 | - 减少基础架构任务的重复性
1363 |
1364 |
1365 |
1366 | 为什么选择Terraform,而不选择其他技术? (例如,Ansible,Puppet,CloufFormation)
1367 |
1368 | 常见的错误答案是说 Ansible 和 Puppet 是配置管理工具而 Terraform 是置备工具。 尽管从技术上讲是正确的,但这并不意味着 Ansible 和 Puppet 不能
1369 | 用于配置基础结构。 另外,这根本没有解释为什么应该在 CloudFormation上 使用 Terraform。
1370 |
1371 | Terraform与其他工具相比的优势:
1372 |
1373 | * 它遵循不变的基础架构方法,该方法具有避免配置随时间变化的优势
1374 | * Ansible和Puppet具有更多的过程性(你提到了每个步骤要执行的操作),而Terraform是声明性的,因为你描述的是总体所需的状态,而不是每个资源或任务的状态。 你可以举一个在每个工具中从1台服务器转到2台服务器的示例。 在terrform中,你指定2,在Ansible和puppet中,你仅需配置1个其他服务器,因此你需要明确确保仅配置另一台服务器。
1375 |
1376 |
1377 |
1378 | 解释什么是"Terraform configuration"
1379 |
1380 |
1381 |
1382 | 解释以下每个:
1383 |
1384 | * Provider
1385 | * Resource
1386 | * Provisioner
1387 |
1388 |
1389 |
1390 | terraform.tfstate
文件用来做什么?
1391 |
1392 | 它跟踪创建的资源的ID,以便Terraform知道它正在管理什么。
1393 |
1394 |
1395 |
1396 | 解释以下命令的作用:
1397 |
1398 | * terraform init
1399 | * terraform plan
1400 | * terraform validate
1401 | * terraform apply
1402 |
1403 |
1404 | terraform init
扫描你的代码以查明你正在使用哪些提供程序并下载它们。
1405 | terraform plan
可以让你在实际执行操作之前先查看terraform即将执行的操作。
1406 | terraform apply
将提供指定的.tf文件资源。
1407 |
1408 |
1409 |
1410 | 如何记下一个由外部源或者通过 terraform apply
改变的变量?
1411 |
1412 | 你用这种方式: variable “my_var” {}
1413 |
1414 |
1415 |
1416 | 举例说明几种Terraform最佳实践
1417 |
1418 |
1419 |
1420 | 解释一下隐式和显式依赖项在Terraform中如何工作
1421 |
1422 |
1423 |
1424 | 什么是local-exec
and remote-exec
in the context of provisioners?
1425 |
1426 |
1427 |
1428 | 什么是"tainted 资源"?
1429 |
1430 | 这是成功创建的资源,但在配置期间失败。 Terraform将失败,并将该资源标记为“tainted”。
1431 |
1432 |
1433 |
1434 | terraform taint
做了什么?
1435 |
1436 |
1437 |
1438 | Terraform支持哪些类型的变量?
1439 |
1440 | Strimg
1441 | Integer
1442 | Map
1443 | List
1444 |
1445 |
1446 |
1447 | 什么是输出变量以及 terraform output
做了什么?
1448 |
1449 |
1450 |
1451 | 解释 Modules
1452 |
1453 |
1454 |
1455 | 什么是 Terraform Registry?
1456 |
1457 |
1458 |
1459 | #### 高级
1460 |
1461 |
1462 | 解释 "Remote State". 什么时候使用它以及如何使用它?
1463 |
1464 |
1465 |
1466 | 解释 "State Locking"
1467 |
1468 |
1469 | ## Docker
1470 |
1471 |
1472 |
1473 | #### 初级
1474 |
1475 |
1476 | 什么是Docker? 你用它做什么?
1477 |
1478 |
1479 |
1480 | 容器与VM有何不同?
1481 |
1482 | 容器和虚拟机之间的主要区别是容器使你可以虚拟化
1483 | 操作系统上有多个工作负载,而对于VM,则将硬件虚拟化为
1484 | 在多台计算机上运行各自的操作系统。
1485 |
1486 |
1487 |
1488 | 在哪种情况下,你将使用容器,而在哪种情况下,则更喜欢使用虚拟机?
1489 |
1490 | 在以下情况下,你应该选择虚拟机:
1491 | * 你需要运行一个需要操作系统所有资源和功能的应用程序
1492 | * 你需要完全隔离和安全
1493 |
1494 | 在以下情况下,你应该选择容器:
1495 | * 你需要快速启动的轻量级解决方案
1496 | * 运行单个应用程序的多个版本或实例
1497 |
1498 |
1499 |
1500 | 解释一下 Docker 架构
1501 |
1502 |
1503 |
1504 | 详细描述一下当运行`docker run hello-world`时背后发生了什么?
1505 |
1506 | Docker CLI 将你的请求传递给Docker守护程序。
1507 | Docker 守护程序从 Docker Hub 下载映像
1508 | Docker 守护程序使用下载的映像创建一个新容器
1509 | Docker 守护程序将输出从容器重定向到 Docker CLI,后者将其重定向到标准输出
1510 |
1511 |
1512 |
1513 | 你怎样运行容器?
1514 |
1515 |
1516 |
1517 | 你熟悉那些与容器相关的最佳实践?
1518 |
1519 |
1520 |
1521 | `docker commit` 干什么的? 什么时候需要使用它?
1522 |
1523 |
1524 |
1525 | 你如何将数据从一个容器转移到另一个容器?
1526 |
1527 |
1528 |
1529 | 容器存在时容器的数据会发生什么?
1530 |
1531 |
1532 |
1533 | 解释以下每个命令的作用
1534 |
1535 | * docker run
1536 | * docker rm
1537 | * docker ps
1538 | * docker build
1539 | * docker commit
1540 |
1541 |
1542 |
1543 | 如何删除未运行的旧容器?
1544 |
1545 |
1546 | ##### Dockerfile
1547 |
1548 |
1549 | 什么是 Dockerfile
1550 |
1551 |
1552 |
1553 | Dockerfile中 ADD 和 COPY 之间的区别是什么?
1554 |
1555 |
1556 |
1557 | Dockerfile中 CMD 和 RUN 之间的区别是什么?
1558 |
1559 |
1560 |
1561 | 解释一下什么是 Docker compose 以及它用来做什么
1562 |
1563 |
1564 |
1565 | Docker compose,Docker swarm 和 Kubernetes 有什么区别?
1566 |
1567 |
1568 |
1569 | 解释 Docker interlock
1570 |
1571 |
1572 |
1573 | Docker Hub 和 Docker Cloud 之间的区别是什么?
1574 |
1575 | Docker Hub是一个本地 Docker 注册表服务,可让你运行 pull 和 push 命令以从 Docker Hub 安装和部署 Docker映像。
1576 |
1577 | Docker Cloud构建在Docker Hub之上,因此Docker Cloud提供了
1578 | 与Docker Hub相比,你拥有更多的可选/功能。 一个例子是
1579 | 群管理,这意味着你可以在Docker Cloud中创建新的群。
1580 |
1581 |
1582 |
1583 | 存储 Docker 镜像的位置在哪里?
1584 |
1585 |
1586 |
1587 | 解释一下镜像层
1588 |
1589 |
1590 |
1591 | #### 高级
1592 |
1593 |
1594 | 你如何在Docker中管理持久性存储?
1595 |
1596 |
1597 |
1598 | 如何从容器内部连接到容器运行所在的主机的本地主机?
1599 |
1600 |
1601 |
1602 | 如何将文件从Docker容器复制到主机,反之亦然?
1603 |
1604 |
1605 | ## Kubernetes
1606 |
1607 |
1608 | #### 初级
1609 |
1610 |
1611 | 什么是Kubernetes?
1612 |
1613 |
1614 |
1615 | 为什么Docker还不够? 为什么我们需要Kubernetes?
1616 |
1617 |
1618 |
1619 | 描述一下 Kuberenets 的架构
1620 |
1621 |
1622 |
1623 | 你是怎样监控你的 Kuberenets?
1624 |
1625 |
1626 |
1627 | 什么是kubectl? 你如何使用它?
1628 |
1629 |
1630 |
1631 | 什么是kubconfig? 你用它来做什么?
1632 |
1633 |
1634 | ##### Users
1635 |
1636 |
1637 | 你如何创建用户? 用户信息的存储位置?
1638 |
1639 |
1640 |
1641 | 你知道如何不使用 adduser/useradd 命令创建新用户吗?
1642 |
1643 |
1644 | ## Coding
1645 |
1646 |
1647 | #### 初级
1648 |
1649 |
1650 | 你更喜欢将哪种编程语言用于与DevOps相关的任务? 为什么要专门这个?
1651 |
1652 |
1653 |
1654 | 什么是面向对象编程? 它为什么如此重要?
1655 |
1656 |
1657 |
1658 | 解释一下递归
1659 |
1660 |
1661 |
1662 | 解释一下什么是设计模式,并详细描述其中的三个
1663 |
1664 |
1665 |
1666 | 解释 big O 符号
1667 |
1668 |
1669 | ##### Strings
1670 |
1671 |
1672 | 用你想要的任何语言,编写一个函数来确定给定的字符串是否是回文串
1673 |
1674 |
1675 |
1676 | #### 高级
1677 |
1678 |
1679 | 给定3种设计模式。 你知道如何以你选择的任何语言实现(提供示例)这些设计模式?
1680 |
1681 |
1682 | ## Python
1683 |
1684 |
1685 | #### 初级
1686 |
1687 |
1688 | Python编程语言的一些特点是什么?
1689 |
1690 | ```
1691 | 1. 这是一种由 Guido Van Rosum 于1991年创建的高级通用编程语言。
1692 | 2. 语言被解释为CPython(用C语言编写)最常用/维护的实现。
1693 | 3. 它是强类型的。 类型系统是鸭子类型和渐进式的。
1694 | 4. Python注重可读性,并使用空格/缩进代替括号{}
1695 | 5. python 包管理器称为PIP“ pip install packages”,具有超过200.000可用的软件包。
1696 | 6. Python 附带安装了pip和一个大的标准库,为程序员提供了许多预置的解决方案。
1697 | 7. 在python中,“一切”都是一个对象。
1698 |
1699 | 还有许多其他特性,但这是每个python程序员都应该知道的主要特性。
1700 |
1701 | ```
1702 |
1703 |
1704 |
1705 | Python支持哪些数据类型,哪些是可变的? 如何显示某个数据类型是可变的?
1706 |
1707 | 可变数据类型是:
1708 |
1709 | List
1710 | Dictionary
1711 | Set
1712 |
1713 | 不可变数据类型是:
1714 |
1715 | Numbers (int, float, ...)
1716 | String
1717 | Bool
1718 | Tuple
1719 | Frozenset
1720 |
1721 | 通常,你可以使用函数hash()来检查对象的可变性,如果它是可哈希的,则是不可变的,尽管由于用户定义的对象可能是可变的且可哈希的,所以它并不总是按预期工作
1722 |
1723 |
1724 |
1725 | 什么是PEP8? 举例说明3种风格指南
1726 |
1727 | PEP8是Python的编码约定和样式指南的列表
1728 |
1729 | 5 种样式指南:
1730 |
1731 | 1. 将所有行限制为最多79个字符。
1732 | 2. 用两个空行包围顶级函数和类定义。
1733 | 3. 制作一个元素的元组时使用逗号
1734 | 4. 使用空格(而不是制表符)进行缩进
1735 | 5. 每个缩进级别使用4个空格
1736 |
1737 |
1738 |
1739 | 解释一下继承以及如何在Python中使用它
1740 |
1741 | ```
1742 | 根据定义,继承是一种机制,其中一个对象充当另一个对象的基础,并保留其所有对象属性。
1743 |
1744 | 因此,如果B类继承自A类,那么A类的每个特征也将在B类中提供。A类将是“基类”,B类将是“派生类”。
1745 | 当你有几个共享相同功能的类时,这很方便。
1746 |
1747 | 基本语法:
1748 |
1749 | class Base: pass
1750 |
1751 | class Derived(Base): pass
1752 |
1753 | A more forged example:
1754 |
1755 | class Animal:
1756 | def __init__(self):
1757 | print("and I'm alive!")
1758 |
1759 | def eat(self, food):
1760 | print("ñom ñom ñom", food)
1761 |
1762 | class Human(Animal):
1763 | def __init__(self, name):
1764 | print('My name is ', name)
1765 | super().__init__()
1766 |
1767 | def write_poem(self):
1768 | print('Foo bar bar foo foo bar!')
1769 |
1770 | class Dog(Animal):
1771 | def __init__(self, name):
1772 | print('My name is', name)
1773 | super().__init__()
1774 |
1775 | def bark(self):
1776 | print('woof woof')
1777 |
1778 |
1779 | michael = Human('Michael')
1780 | michael.eat('Spam')
1781 | michael.write_poem()
1782 |
1783 | bruno = Dog('Bruno')
1784 | bruno.eat('bone')
1785 | bruno.bark()
1786 |
1787 | >>> My name is Michael
1788 | >>> and I'm alive!
1789 | >>> ñom ñom ñom Spam
1790 | >>> Foo bar bar foo foo bar!
1791 | >>> My name is Bruno
1792 | >>> and I'm alive!
1793 | >>> ñom ñom ñom bone
1794 | >>> woof woof
1795 |
1796 | 调用super()会调用Base方法,因此,调用super().__init__() 就是调用 Animal__init__。
1797 |
1798 | 有一个称为 MetaClasses 的更高级的python功能,可帮助程序员直接控制类的创建。
1799 |
1800 | ```
1801 |
1802 |
1803 |
1804 |
1805 | 什么是一个错误? 什么是一个异常? 你熟悉哪些异常类型?
1806 |
1807 | ```
1808 |
1809 | # 请注意,你通常不需要了解编译过程,而只需知道一切都来自哪里
1810 | # 并给出完整的答案表明你真正知道你在说什么。
1811 |
1812 | 通常,每个编译过程都有两个步骤。
1813 | - 分析
1814 | - 产生代码.
1815 |
1816 | Analysis can be broken into:
1817 | 1. 词法分析 (标记源代码)
1818 | 2. 语法分析 (如果语法正确,请检查标记是否合法,tldr)
1819 |
1820 | for i in 'foo'
1821 | ^
1822 | SyntaxError: invalid syntax
1823 |
1824 | We missed ':'
1825 |
1826 |
1827 | 3. 语义分析 (上下文分析,合法语法仍然会触发错误,你是否尝试过除以0,哈希可变对象或使用未声明的函数?)
1828 |
1829 | 1/0
1830 | ZeroDivisionError: division by zero
1831 |
1832 | 这三个分析步骤负责错误处理。
1833 |
1834 | 第二步将负责错误,主要是语法错误,这是最常见的错误。
1835 | 第三步将负责异常。
1836 |
1837 | 如我们所见,异常是语义错误,有许多内置的异常:
1838 |
1839 | ImportError
1840 | ValueError
1841 | KeyError
1842 | FileNotFoundError
1843 | IndentationError
1844 | IndexError
1845 | ...
1846 |
1847 | 你还可以具有用户定义的异常,这些异常必须直接或间接地从Exception类继承。
1848 |
1849 | 常见例子:
1850 |
1851 | class DividedBy2Error(Exception):
1852 | def __init__(self, message):
1853 | self.message = message
1854 |
1855 |
1856 | def division(dividend,divisor):
1857 | if divisor == 2:
1858 | raise DividedBy2Error('I dont want you to divide by 2!')
1859 | return dividend / divisor
1860 |
1861 | division(100, 2)
1862 |
1863 | >>> __main__.DividedBy2Error: I dont want you to divide by 2!
1864 |
1865 | ```
1866 |
1867 |
1868 |
1869 |
1870 |
1871 | 解释 异常处理以及如何在Python中使用它
1872 |
1873 |
1874 |
1875 | 编写一个可以恢复字符串的程序(例如,pizza -> azzip)
1876 |
1877 | ```
1878 | 最简单的是 str[::-1] 但不是效率最高的.
1879 |
1880 | "经典" 方式:
1881 |
1882 | foo = ''
1883 |
1884 | for char in 'pizza':
1885 | foo = char + foo
1886 |
1887 | >> 'azzip'
1888 |
1889 | ```
1890 |
1891 |
1892 |
1893 |
1894 | 编写一个函数以返回一个或多个数字的和。 用户将决定要使用多少个数字
1895 |
1896 | 首先,你询问用户要使用的数字量。 使用while循环,每个循环将amount_of_numbers减1,直到amount_of_numbers变为0。 在while循环中,你想询问用户一个数字,该数字将在每次循环运行时添加一个变量。
1897 |
1898 | ```
1899 | def return_sum():
1900 | amount_of_numbers = int(input("How many numbers? "))
1901 | total_sum = 0
1902 | while amount_of_numbers != 0:
1903 | num = int(input("Input a number. "))
1904 | total_sum += num
1905 | amount_of_numbers -= 1
1906 | return total_sum
1907 |
1908 | ```
1909 |
1910 |
1911 |
1912 | 如何将两个排序列表合并为一个排序列表?
1913 |
1914 |
1915 |
1916 | _ 在 Python 中用于什么?
1917 |
1918 | 1. i18n中的翻译查询
1919 | 2. 将最后执行的表达式或语句的结果保存在交互式解释器中。
1920 | 3. 作为通用“可丢弃”变量名。 例如:x,y,_ = get_data()(使用了x和y,但是由于我们不关心第三个变量,因此我们将其“扔掉了”)。
1921 |
1922 |
1923 | ##### Algorithms Implementation
1924 |
1925 |
1926 | 你可以在Python中实现“二分法搜索”吗?
1927 |
1928 |
1929 | ##### Files
1930 |
1931 |
1932 | 如何写文件?
1933 |
1934 | ```
1935 | with open('file.txt', 'w') as file:
1936 | file.write("My insightful comment")
1937 | ```
1938 |
1939 |
1940 |
1941 | 如何反转文件?
1942 |
1943 |
1944 | #### Regex
1945 |
1946 |
1947 | 如何在Python中执行与正则表达式相关的操作? (匹配模式,替代字符串等)
1948 |
1949 | 使用 re 模式
1950 |
1951 |
1952 |
1953 | 如何用 "blue" 替换字符串 "green"?
1954 |
1955 |
1956 |
1957 | 如何找到一个变量中的所有IP地址? 如何在文件中找到它们?
1958 |
1959 |
1960 |
1961 | 按每个嵌套列表的第二项对列表列表进行排序
1962 |
1963 | ```
1964 | li = [[1, 4], [2, 1], [3, 9], [4, 2], [4, 5]]
1965 |
1966 | sorted(x, key=lambda l: l[1])
1967 | ```
1968 |
1969 |
1970 |
1971 | 你可以编写一个函数来打印给定目录中的所有文件吗? 包括子目录
1972 |
1973 |
1974 |
1975 | 你有下面的列表: [{'name': 'Mario', 'food': ['mushrooms', 'goombas']}, {'name': 'Luigi', 'food': ['mushrooms', 'turtles']}]
1976 | 获取所有的食物类型,最后输出: {'mushrooms', 'goombas', 'turtles'}
1977 |
1978 | ```
1979 | brothers_menu = \
1980 | [{'name': 'Mario', 'food': ['mushrooms', 'goombas']}, {'name': 'Luigi', 'food': ['mushrooms', 'turtles']}]
1981 |
1982 | # "经典" 方式
1983 | def get_food(brothers_menu) -> set:
1984 | temp = []
1985 |
1986 | for brother in brothers_menu:
1987 | for food in brother['food']:
1988 | temp.append(food)
1989 |
1990 | return set(temp)
1991 |
1992 | # 一直先行方式 (Using list comprehension)
1993 | set([food for bro in x for food in bro['food']])
1994 | ```
1995 |
1996 |
1997 |
1998 |
1999 | 什么是List 加强? 它比典型的循环更好吗? 为什么? 你能示范如何使用它吗?
2000 |
2001 |
2002 |
2003 | 怎样反转 string?
2004 |
2005 | 最简短的方式是: my_string[::-1]
但是这不是效率最高的.
2006 | 经典方式是:
2007 | ```
2008 | def reverse_string(string):
2009 | temp = ""
2010 | for char in string:
2011 | temp = char + temp
2012 | return temp
2013 | ```
2014 |
2015 |
2016 |
2017 | 如何按值对字典排序?
2018 |
2019 |
2020 |
2021 | 如何按键对字典排序?
2022 |
2023 |
2024 |
2025 | 解释数据序列化以及如何使用Python执行
2026 |
2027 |
2028 |
2029 | 你如何在Python中处理参数解析?
2030 |
2031 |
2032 |
2033 | 解释什么是GIL
2034 |
2035 |
2036 |
2037 | 什么是迭代器? 为什么使用迭代器?
2038 |
2039 |
2040 |
2041 | 解释以下方法的类型以及如何使用它们:
2042 |
2043 | * Static method
2044 | * Class method
2045 | * instance method
2046 |
2047 |
2048 |
2049 | 怎样反转 list?
2050 |
2051 |
2052 |
2053 | 空的 return
返回什么?
2054 |
2055 |
2056 | ##### Time Complexity
2057 |
2058 |
2059 | 描述操作的时间复杂度access
, search
insert
and remove
下面的数据结构:
2060 |
2061 | * Stack
2062 | * Queue
2063 | * Linked List
2064 | * Binary Search Tree
2065 |
2066 |
2067 |
2068 | 以下算法的最好,最差和平均情况的复杂度是什么?:
2069 |
2070 | * Quicksort
2071 | * Mergesort
2072 | * Bucket Sort
2073 | * Radix Sort
2074 |
2075 |
2076 |
2077 | #### 高级
2078 |
2079 |
2080 | 解释什么是装饰器
2081 |
2082 |
2083 |
2084 | 你能展示如何编写和使用装饰器吗?
2085 |
2086 |
2087 |
2088 | 编写脚本来确定给定端口上是否可以访问给定主机
2089 |
2090 |
2091 |
2092 | 这个查询熟悉数据类吗? 你能解释一下他们是干什么用的吗?
2093 |
2094 |
2095 |
2096 | 解释一下上下文管理
2097 |
2098 |
2099 |
2100 | 解释一下缓冲协议
2101 |
2102 |
2103 |
2104 | 解释一下描述符
2105 |
2106 |
2107 |
2108 | 你有抓取网络(爬虫)的经验吗? 你能描述一下你用过什么以及用什么?
2109 |
2110 |
2111 |
2112 | 你可以在Python中实现链接链表吗?
2113 |
2114 |
2115 |
2116 | 你已经创建了一个网页,用户可以在其中上传文档。 但是,根据文档大小,读取上传文件的功能会运行很长时间,并且用户必须等待读取操作完成才能继续使用该网站。 你怎么能解决这个问题?
2117 |
2118 |
2119 | ## Prometheus
2120 |
2121 |
2122 | #### 初级
2123 |
2124 |
2125 | 什么是Prometheus? Prometheus的主要特点是什么?
2126 |
2127 |
2128 |
2129 | 描述 Prometheus 架构和组件
2130 |
2131 |
2132 |
2133 | 你能否将 Prometheus 与其他解决方案(例如InfluxDB)进行比较?
2134 |
2135 |
2136 |
2137 | 什么是an Alert?
2138 |
2139 |
2140 |
2141 | 描述以下Prometheus组件:
2142 |
2143 | * Prometheus server
2144 | * Push Gateway
2145 | * Alert Manager
2146 |
2147 | 负责抓取存储数据的Prometheus服务器推送网关用于短期作业警报管理负责警报 ;)
2148 |
2149 |
2150 |
2151 | 什么是一个实例? 什么是一个作业?
2152 |
2153 |
2154 |
2155 | Prometheus支持哪些核心指标类型?
2156 |
2157 |
2158 |
2159 | 什么是一个 exporter? 它用来做什么?
2160 |
2161 |
2162 |
2163 | 你熟悉哪些Prometheus最佳做法? 至少命名三个
2164 |
2165 |
2166 |
2167 | 如何在给定时间内获得总请求?
2168 |
2169 |
2170 |
2171 | #### 高级
2172 |
2173 |
2174 | 你如何加入两个指标?
2175 |
2176 |
2177 |
2178 | 如何编写返回标签值的查询?
2179 |
2180 |
2181 |
2182 | 如何将cpu_user_seconds转换为cpu使用率(百分比)?
2183 |
2184 |
2185 | ## Git
2186 |
2187 |
2188 | #### 初级
2189 |
2190 |
2191 | git pull
和 git fetch
的区别是什么?
2192 |
2193 | 简单来说, git pull = git fetch + git merge
2194 |
2195 | 当你运行git pull时,它会从远程或中央获取所有更改
2196 | 存储库,并将其附加到本地存储库中的相应分支。
2197 |
2198 | git fetch从远程存储库获取所有更改,将更改存储在
2199 | 本地存储库中的单独分支
2200 |
2201 |
2202 |
2203 | 解释以下: git 目录
, 工作目录
和 暂存区
2204 |
2205 | Git目录是Git存储项目的元数据和对象数据库的地方。 这是Git最重要的部分,当你从另一台计算机克隆存储库时,它就是复制的。
2206 |
2207 | 工作目录是项目一个版本的单个签出。 这些文件将从Git目录中的压缩数据库中拉出,并放置在磁盘上供你使用或修改。
2208 |
2209 | 暂存区是一个简单文件,通常包含在你的Git目录中,用于存储有关下一次提交的内容的信息。 有时称为索引,但将其称为暂存区已成为标准。
2210 |
2211 | 答案来自 [git-scm.com](https://git-scm.com/book/en/v1/Getting-Started-Git-Basics#_the_three_states)
2212 |
2213 |
2214 |
2215 | 怎么解决 git merge 冲突?
2216 |
2217 |
2218 | 首先,打开有冲突的文件,然后确定有什么冲突。
2219 | 接下来,根据你的公司或团队接受的是什么,你可以与自己的
2220 | 同事解决冲突或自行解决
2221 | 解决冲突后,使用 git add 添加文件。
2222 | 最后,运行`git rebase --continue`。
2223 |
2224 |
2225 |
2226 |
2227 | git reset
和 git revert
区别是什么?
2228 |
2229 |
2230 |
2231 | `git revert` 创建一个新的提交,撤消上一次提交的更改。
2232 |
2233 | `git reset` 根据使用情况,可以修改索引或更改分支头当前指向的提交。
2234 |
2235 |
2236 |
2237 |
2238 | 你想将提交移至顶部。 你将如何实现?
2239 |
2240 | 使用 git rebase>
命令
2241 |
2242 |
2243 |
2244 | 那种情形你会使用 git rebase
?
2245 |
2246 |
2247 |
2248 | 你熟悉哪些合并策略?
2249 |
2250 | 提及两个或三个就足够了,最好提到“递归”作为默认值。
2251 |
2252 | recursive
2253 | resolve
2254 | ours
2255 | theirs
2256 |
2257 | 这篇文章解释是最好的: https://git-scm.com/docs/merge-strategies
2258 |
2259 |
2260 |
2261 | 在提交更改之前,如何查看已完成的更改?
2262 |
2263 | git diff
2264 |
2265 |
2266 |
2267 | 如何将特定文件还原为先前的提交?
2268 |
2269 | ```
2270 | git checkout HEAD~1 -- /path/of/the/file
2271 | ```
2272 |
2273 |
2274 |
2275 |
2276 | #### 高级
2277 |
2278 |
2279 | 解释 Git octopus merge
2280 |
2281 | 也许不错,它是:
2282 |
2283 | * 对于合并多个分支的情况(以及此类用例的默认情况)非常有用
2284 | * 主要用于将主题分支捆绑在一起
2285 |
2286 | 有一篇文章关于 Octopus merge: http://www.freblogg.com/2016/12/git-octopus-merge.html
2287 |
2288 |
2289 | ## Go
2290 |
2291 |
2292 | #### 初级
2293 |
2294 |
2295 | Go编程语言有哪些特点?
2296 |
2297 | * 强类型和静态类型 - 变量的类型不能随时间更改,必须在编译时进行定义
2298 | * 简单
2299 | * 快速编译时间
2300 | * 内置并发
2301 | * 垃圾回收
2302 | * 平台无关
2303 | * 编译为独立的二进制文件 - 你运行应用程序所需的所有内容都将被编译为一个二进制文件。 对于运行时的版本管理非常有用。
2304 |
2305 | Go 而且有一个很好的社区.
2306 |
2307 |
2308 |
2309 | var x int = 2
和 x := 2
区别是什么?
2310 |
2311 | 结果相同,变量值为2。
2312 |
2313 | with var x int = 2
we are setting the variable type to integer while with x := 2
we are letting Go figure out by itself the type.
2314 |
2315 |
2316 |
2317 | 对还是错? 在Go中,我们可以重新声明变量,并且一旦声明就必须使用它.
2318 |
2319 | 错. 我们不能重新声明变量,必须使用声明的变量。
2320 |
2321 |
2322 |
2323 | 你使用了哪些Go库?
2324 |
2325 | 应该根据你的使用情况回答此问题,一些示例是:
2326 | * fmt - formatted I/O
2327 |
2328 |
2329 |
2330 | 下面代码块有什么问题? 怎么解决?
2331 |
2332 | ```
2333 | func main() {
2334 | var x float32 = 13.5
2335 | var y int
2336 | y = x
2337 | }
2338 | ```
2339 |
2340 |
2341 |
2342 |
2343 | 下面的代码块尝试将整数101转换为字符串,但相反,我们得到“ e”。 这是为什么? 怎么解决?
2344 |
2345 | ```
2346 | package main
2347 |
2348 | import "fmt"
2349 |
2350 | func main() {
2351 | var x int = 101
2352 | var y string
2353 | y = string(x)
2354 | fmt.Println(y)
2355 | }
2356 | ```
2357 |
2358 |
2359 | 它看起来在101处设置了什么unicode值,并将其用于将整数转换为字符串。
2360 | 如果要获取“ 101”,则应使用“ strconv” 软件包,然后替换 y = string(x)
with y = strconv.Itoa(x)
2361 |
2362 |
2363 |
2364 | 以下代码块什么是错的?:
2365 |
2366 | ```
2367 | package main
2368 |
2369 | func main() {
2370 | var x = 2
2371 | var y = 3
2372 | const someConst = x + y
2373 | }
2374 | ```
2375 |
2376 |
2377 |
2378 |
2379 | 以下代码块的输出是什么?:
2380 |
2381 | ```
2382 | package main
2383 |
2384 | import "fmt"
2385 |
2386 | const (
2387 | x = iota
2388 | y = iota
2389 | )
2390 | const z = iota
2391 |
2392 | func main() {
2393 | fmt.Printf("%v\n", x)
2394 | fmt.Printf("%v\n", y)
2395 | fmt.Printf("%v\n", z)
2396 | }
2397 | ```
2398 |
2399 |
2400 |
2401 |
2402 | _ 在 Go 中的用途是什么?
2403 |
2404 |
2405 |
2406 | 以下代码块的输出是什么?:
2407 |
2408 | ```
2409 | package main
2410 |
2411 | import "fmt"
2412 |
2413 | const (
2414 | _ = iota + 3
2415 | x
2416 | )
2417 |
2418 | func main() {
2419 | fmt.Printf("%v\n", x)
2420 | }
2421 | ```
2422 |
2423 |
2424 |
2425 | ## Mongo
2426 |
2427 |
2428 | #### 初级
2429 |
2430 |
2431 | MongoDB有什么优势? 换句话说,为什么选择 MongoDB 而不选择 NoSQL 的其他实现?
2432 |
2433 |
2434 |
2435 | SQL和NoSQL之间的区别是什么?
2436 |
2437 | 主要区别在于SQL数据库是结构化的(数据以带有行和列的表格-像是Excel电子表格表格),而NoSQL是
2438 | 非结构化的,并且数据存储会根据NoSQL DB的设置方式而有所不同,例如
2439 | 作为键值对,面向文档等
2440 |
2441 |
2442 |
2443 | 在哪种情况下,这个查询希望使用 NoSQL/Mongo 而不是SQL?
2444 |
2445 | * 经常变化的异构数据
2446 | * 数据一致性和完整性不是重中之重
2447 | * 最好,如果数据库需要快速扩展
2448 |
2449 |
2450 |
2451 | 什么是一个文档? 什么是一个集合?
2452 |
2453 |
2454 |
2455 | 什么是一个聚合?
2456 |
2457 |
2458 |
2459 | 那个更好? 嵌入文档还是引用?
2460 |
2461 |
2462 | ##### Queries
2463 |
2464 |
2465 | 解释这个查询: db.books.find({"name": /abc/})
2466 |
2467 |
2468 |
2469 | 解释这个查询: db.books.find().sort({x:1})
2470 |
2471 |
2472 | ## OpenShift
2473 |
2474 |
2475 | #### 初级
2476 |
2477 |
2478 | 什么是OpenShift? 你用过吗? 如果有,是怎样使用的?
2479 |
2480 |
2481 |
2482 | 你能解释一下 OpenShift 和 Kubernetes 之间的区别吗?
2483 |
2484 |
2485 |
2486 | 定义 Pods 以及解释什么是有状态的 pods
2487 |
2488 |
2489 |
2490 | 你熟悉哪些类型的构建策略?
2491 |
2492 |
2493 |
2494 | 解释标签是什么以及它们的用途
2495 |
2496 |
2497 |
2498 | 解释什么是注释以及它们与标签的区别
2499 |
2500 |
2501 |
2502 | 解释什么是Downward API
2503 |
2504 |
2505 | ## Shell 脚本
2506 |
2507 |
2508 | #### 初级
2509 |
2510 |
2511 | 告诉我你使用Shell脚本的经验
2512 |
2513 |
2514 |
2515 | 脚本中的这一行是什么意思?: #!/bin/bash
2516 |
2517 |
2518 |
2519 | 你倾向于在编写的每个脚本中包含什么?
2520 |
2521 |
2522 |
2523 | 对还是错?: 当某个命令行失败时,默认情况下,该脚本将退出并且不会继续运行
2524 |
2525 | 取决于所使用的语言和设置,例如在Bash中,默认情况下,脚本将继续运行。
2526 |
2527 |
2528 |
2529 | 今天,我们拥有Ansible之类的工具和技术。 为什么还会有人使用Shell脚本?
2530 |
2531 |
2532 |
2533 | 说出下面每个命令的结果是什么:
2534 |
2535 | * echo $0
2536 | * echo $?
2537 | * echo $$
2538 | * echo $@
2539 | * echo $#
2540 |
2541 |
2542 |
2543 | 你如何调试Shell脚本?
2544 |
2545 |
2546 |
2547 | 如何在Shell脚本中从用户获得输入?
2548 |
2549 |
2550 |
2551 | 解释一下条件语句以及如何使用它们
2552 |
2553 |
2554 |
2555 | 什么是循环? 你熟悉哪些类型的循环?
2556 |
2557 |
2558 |
2559 | 解释 continue
和 break
. 你什么时候使用它们?
2560 |
2561 |
2562 |
2563 | 如何将命令的输出存储在变量中?
2564 |
2565 |
2566 |
2567 | 你如何检查可变长度?
2568 |
2569 |
2570 |
2571 | 单引号和双引号之间的区别是什么?
2572 |
2573 |
2574 |
2575 | #### 高级
2576 |
2577 |
2578 | 解释以下代码:
2579 |
2580 | :(){ :|:& };:
2581 |
2582 |
2583 |
2584 |
2585 |
2586 | 你能举一些Bash最佳实践的例子吗?
2587 |
2588 |
2589 |
2590 | 什么是三元运算符? 你如何在bash中使用它?
2591 |
2592 | 使用 if/else 的一种简短方法。 一个例子:
2593 |
2594 | [[ $a = 1 ]] && b="yes, equal" || b="nope"
2595 |
2596 |
2597 | ## SQL
2598 |
2599 |
2600 | #### 初级
2601 |
2602 |
2603 | SQL 代表什么?
2604 |
2605 | Structured Query Language(结构化查询语言)
2606 |
2607 |
2608 |
2609 |
2610 | SQL 和 NoSQL 有那些不同
2611 |
2612 | 主要区别在于SQL数据库是结构化的(数据以
2613 | 带有行和列的表格-像是Excel电子表格表格),而NoSQL是
2614 | 非结构化的,并且数据存储会根据NoSQL DB的设置方式而有所不同,例如
2615 | 作为键值对,面向文档等
2616 |
2617 |
2618 |
2619 | 数据库符合ACID的含义是什么?
2620 |
2621 | ACID代表原子性,一致性,隔离性,耐久性。为了符合ACID,数据库必须满足四个标准中的每个标准
2622 |
2623 | **原子性** - 数据库发生更改时,它整体上应该成功或失败。
2624 |
2625 | 例如,如果你要更新表,则更新应完全执行。如果仅部分执行,则
2626 | 更新被视为整体失败,并且不会通过-数据库将恢复为原始状态
2627 | 更新发生之前的状态。还应该提到的是,原子性确保每个
2628 | 事务以其自身的独立“单元”完成 - 如果任何部分失败,则整个语句都会失败。
2629 |
2630 | **一致性** - 对数据库所做的任何更改都应将其从一种有效状态转变为另一种有效状态。
2631 |
2632 | 例如,如果你对数据库进行了更改,则不应破坏它。通过检查和约束来保持一致性
2633 | 在数据库中预定义。例如,如果你尝试将列的值从字符串更改为int
2634 | 应该是数据类型字符串,一致的数据库将不允许该事务通过,并且该操作将
2635 | 不执行
2636 |
2637 | **隔离** - 确保数据库不会被“更新中”-因为多个事务正在运行
2638 | 同时,它仍应保持数据库处于与按顺序运行事务相同的状态。
2639 |
2640 | 例如,假设有20个人同时对数据库进行了更改。在
2641 | 当你执行查询时,已完成20项更改中的15项,但仍有5项正在进行中。你应该
2642 | 仅看到已完成的15个更改 - 随着更改的进行,你将看不到数据库的更新中。
2643 |
2644 | **耐用性** - 更改一旦提交,无论发生什么情况都将保持提交状态
2645 | (电源故障,系统崩溃等)。这意味着所有已完成的交易
2646 | 必须记录在非挥发性内存中。
2647 |
2648 | 请注意,SQL本质上符合ACID。某些NoSQL DB可能符合ACID,具体取决于
2649 | 它们的工作方式,但是根据一般经验,NoSQL DB不被视为符合ACID
2650 |
2651 |
2652 |
2653 | 什么时候最好使用SQL/NoSQL?
2654 |
2655 | SQL - 当数据完整性至关重要时,最适合使用。 由于符合ACID,SQL通常由许多业务实现特别是金融领域。
2656 |
2657 | NoSQL - 非常适合你需要快速扩展的情况。 请记住NoSQL是为Web应用程序设计的
2658 | ,如果你需要快速将相同信息散布到多台服务器,它将会很好的用
2659 | 此外,由于 NoSQL 不遵守具有列和行结构的严格表
2660 | 关系数据库所要求的,你可以将不同的数据类型存储在一起。
2661 |
2662 |
2663 |
2664 | 什么是笛卡尔积?
2665 |
2666 | 笛卡尔积是指第一个表中的所有行都与第二个表中的所有行连接在一起时的结果
2667 | 表。 这可以通过不定义要联接的键来隐式完成,也可以通过以下方式显式地完成:
2668 | 在两个表上调用CROSS JOIN,如下所示:
2669 |
2670 | Select * from customers **CROSS JOIN** orders;
2671 |
2672 | 请注意,笛卡尔积也可能是一件坏事 - 执行联接时
2673 | 在两个都没有唯一键的表上,这可能会导致返回信息
2674 | 是不正确的。
2675 |
2676 |
2677 | ##### SQL Specific Questions
2678 |
2679 | 对于这些问题,我们将使用下面显示的“客户和订单”表:
2680 |
2681 | **Customers**
2682 |
2683 | Customer_ID | Customer_Name | Items_in_cart | Cash_spent_to_Date
2684 | ------------ | ------------- | ------------- | -------------
2685 | 100204 | John Smith | 0 | 20.00
2686 | 100205 | Jane Smith | 3 | 40.00
2687 | 100206 | Bobby Frank | 1 | 100.20
2688 |
2689 | **ORDERS**
2690 |
2691 | Customer_ID | Order_ID | Item | Price | Date_sold
2692 | ------------ | ------------- | ------------- | ------------- | -------------
2693 | 100206 | A123 | Rubber Ducky | 2.20 | 2019-09-18
2694 | 100206 | A123 | Bubble Bath | 8.00 | 2019-09-18
2695 | 100206 | Q987 | 80-Pack TP | 90.00 | 2019-09-20
2696 | 100205 | Z001 | Cat Food - Tuna Fish | 10.00 | 2019-08-05
2697 | 100205 | Z001 | Cat Food - Chicken | 10.00 | 2019-08-05
2698 | 100205 | Z001 | Cat Food - Beef | 10.00 | 2019-08-05
2699 | 100205 | Z001 | Cat Food - Kitty quesadilla | 10.00 | 2019-08-05
2700 | 100204 | X202 | Coffee | 20.00 | 2019-04-29
2701 |
2702 |
2703 | 我如何从该表中选择所有字段?
2704 |
2705 | Select *
2706 | From Customers;
2707 |
2708 |
2709 |
2710 | 约翰的购物车中有几件?
2711 |
2712 | Select Items_in_cart
2713 | From Customers
2714 | Where Customer_Name = "John Smith";
2715 |
2716 |
2717 |
2718 | 所有客户花费的所有现金的总和是多少?
2719 |
2720 | Select SUM(Cash_spent_to_Date) as SUM_CASH
2721 | From Customers;
2722 |
2723 |
2724 |
2725 | 在购物车有商品的有多少人?
2726 |
2727 | Select count(1) as Number_of_People_w_items
2728 | From Customers
2729 | where Items_in_cart > 0;
2730 |
2731 |
2732 |
2733 | 你如何将客户表加入订单表?
2734 |
2735 | 你可以加入他们的唯一键。 在这种情况下,唯一键为中的Customer_ID
2736 | 客户表和订单表
2737 |
2738 |
2739 |
2740 | 你如何显示哪些客户订购了哪些物品?
2741 |
2742 | Select c.Customer_Name, o.Item
2743 | From Customers c
2744 | Left Join Orders o
2745 | On c.Customer_ID = o.Customer_ID;
2746 |
2747 |
2748 |
2749 |
2750 | #### 高级
2751 |
2752 |
2753 | 使用with语句,你将如何显示谁订购了猫粮以及花费的总金额?
2754 |
2755 | with cat_food as (
2756 | Select Customer_ID, SUM(Price) as TOTAL_PRICE
2757 | From Orders
2758 | Where Item like "%Cat Food%"
2759 | Group by Customer_ID
2760 | )
2761 | Select Customer_name, TOTAL_PRICE
2762 | From Customers c
2763 | Inner JOIN cat_food f
2764 | ON c.Customer_ID = f.Customer_ID
2765 | where c.Customer_ID in (Select Customer_ID from cat_food);
2766 |
2767 | 尽管这是一个简单的声明,但“ with”子句在
2768 | 在连接到另一个表之前,需要在一个表上运行一个复杂的查询。 用语句很好,
2769 | 因为你在运行查询时会创建一个伪临时文件,而不是创建一个新表。
2770 |
2771 | 目前尚无法获得所有猫粮的总和,因此我们使用了with语句来创建
2772 | 伪表检索每个客户花费的价格总和,然后正常加入该表。
2773 |
2774 |
2775 |
2776 | ## Azure
2777 |
2778 |
2779 | #### 初级
2780 |
2781 |
2782 | 解释一下可用性集和可用性区域
2783 |
2784 |
2785 |
2786 | 什么是Azure资源管理器? 你可以描述ARM模板的格式吗?
2787 |
2788 |
2789 |
2790 | 解释一下Azure托管磁盘
2791 |
2792 |
2793 | ## GCP
2794 |
2795 |
2796 | #### 初级
2797 |
2798 |
2799 | GCP的主要组件和服务是什么?
2800 |
2801 |
2802 |
2803 | 你熟悉哪些GCP管理工具?
2804 |
2805 |
2806 |
2807 | 告诉我对GCP联网了解多少
2808 |
2809 |
2810 | ## OpenStack
2811 |
2812 |
2813 | #### 初级
2814 |
2815 |
2816 | 告诉我你使用OpenStack的经验。 你认为OpenStack的优缺点是什么?
2817 |
2818 |
2819 |
2820 | 你熟悉OpenStack的哪些组件/项目?
2821 |
2822 |
2823 |
2824 | 你能告诉我以下每个组件/项目负责什么吗?:
2825 |
2826 | * Nova
2827 | * Neutron
2828 | * Cinder
2829 | * Glance
2830 | * Keystone
2831 |
2832 |
2833 |
2834 | 详细描述如何使用可以从云外部访问的IP来启动实例
2835 |
2836 |
2837 |
2838 | 你收到客户打来的电话,说:“我可以ping我的实例,但不能连接(ssh)它”。 可能是什么问题?
2839 |
2840 |
2841 |
2842 | OpenStack支持哪些类型的网络?
2843 |
2844 |
2845 |
2846 | 你如何调试OpenStack存储问题? (工具,日志等)
2847 |
2848 |
2849 |
2850 | 你如何调试OpenStack计算问题? (工具,日志等)
2851 |
2852 |
2853 |
2854 | 你熟悉 TripleO吗? 它有那些优点?
2855 |
2856 |
2857 | ##### 网络
2858 |
2859 |
2860 | 什么是供应商网络?
2861 |
2862 |
2863 |
2864 | L2和L3中存在哪些组件和服务?
2865 |
2866 |
2867 |
2868 | 什么是ML2 plug-in? 解释一下它的架构
2869 |
2870 |
2871 |
2872 | 什么是L2 代理? 它是怎么工作的以及它主要负责什么?
2873 |
2874 |
2875 |
2876 | 什么是L3 代理? 它是怎么工作的以及它主要负责什么?
2877 |
2878 |
2879 |
2880 | 解释元数据代理是怎么工作的以及它主要负责什么
2881 |
2882 |
2883 |
2884 | 你如何调试OpenStack网络问题? (工具,日志等)
2885 |
2886 |
2887 |
2888 | #### 中级
2889 |
2890 | ##### 网络
2891 |
2892 |
2893 | 解释 BGP 动态路由
2894 |
2895 |
2896 | ## 安全
2897 |
2898 |
2899 | #### 初级
2900 |
2901 |
2902 | 你能描述一下DevSecOps的核心原理吗?
2903 |
2904 |
2905 |
2906 | 你熟悉哪些DevOps安全最佳实践?
2907 |
2908 |
2909 |
2910 | 你熟悉哪些安全技术?
2911 |
2912 |
2913 |
2914 | 如何在不同的工具和平台中管理密码?
2915 |
2916 |
2917 |
2918 | 你如何识别和管理漏洞?
2919 |
2920 |
2921 |
2922 | 什么是权限限制?
2923 |
2924 |
2925 | ## Puppet
2926 |
2927 |
2928 | #### 初级
2929 |
2930 |
2931 | 什么是Puppet? 它是怎么工作的?
2932 |
2933 |
2934 |
2935 | 解释一下 Puppet 结构
2936 |
2937 |
2938 |
2939 | 你可以将Puppet与其他配置管理工具进行比较吗? 你为什么选择使用Puppet?
2940 |
2941 |
2942 |
2943 | 解释以下:
2944 |
2945 | * Module
2946 | * Manifest
2947 | * Node
2948 |
2949 |
2950 |
2951 | 解释一下Facter
2952 |
2953 |
2954 |
2955 | 什么是MCollective?
2956 |
2957 |
2958 |
2959 | #### 中级
2960 |
2961 |
2962 | 你有编写模块的经验吗? 你创建了哪个模块以及用于什么?
2963 |
2964 |
2965 |
2966 | 解释一下什么是Hiera
2967 |
2968 |
2969 | ## 场景
2970 |
2971 | 方案是没有口头回答的问题,需要你满足以下条件之一:
2972 |
2973 | * 设置环境
2974 | * 编写脚本
2975 | * 设计和/或开发基础设施项目
2976 |
2977 | 这些问题通常作为应聘者的一项家庭任务作为候选,可以将多个主题结合在一起。
2978 | 在下面,你可以找到一些场景问题:
2979 |
2980 | * [Elasticsearch & Kibana on AWS](scenarios/elk_kibana_aws.md)
2981 | * [Ansible, Minikube and Docker](scenarios/ansible_minikube_docker.md)
2982 | * [Cloud Slack bot](scenarios/cloud_slack_bot.md)
2983 | * [Writing Jenkins Scripts](scenarios/jenkins_scripts.md)
2984 | * [Writing Jenkins Pipelines](scenarios/jenkins_pipelines.md)
--------------------------------------------------------------------------------
/coding/python/binary_search.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import random
4 |
5 | rand_num_li = sorted([random.randint(1, 50) for iter in range(10)])
6 | target = random.randint(1, 50)
7 |
8 | def binary_search(li, le, ri, target):
9 | if le <= ri:
10 | mid = ri + le // 2
11 | if li[mid] == target:
12 | return mid
13 | elif li[mid] < target:
14 | return binary_search(li, mid + 1, ri, target)
15 | else:
16 | return binary_search(li, le, mid - 1, target)
17 | else:
18 | return -1
19 |
20 |
21 | print("List: {}\nTarget: {}\nIndex: {}".format(
22 | rand_num_li, target,
23 | binary_search(rand_num_li, 0, len(rand_num_li) - 1, target)))
24 |
--------------------------------------------------------------------------------
/common-qa.md:
--------------------------------------------------------------------------------
1 | ## Q&A
2 |
3 | ### What is the purpose of repository?
4 |
5 | To learn, of course :)
6 | Or more specifically:
7 |
8 | * Measure your knowledge
9 | * Help you prepare to interviews
10 | * Simply learning something new :)
11 |
12 | ### Are these real DevOps interview questions?
13 |
14 | Well, first of all, most of the questions in this repo aren't really DevOps questions. They are operational, development, HR, ... questions. Probably less than 3% percentage are actual DevOps questions but whether we like it or not, some DevOps interviews (or most) include them and this is why they are included in this repository.
15 |
16 | There are many versions of DevOps interviews today. Some will include questions like in this project while other versions can be for example merely on your C.V and will not include even one question from this repository.
17 |
18 | Also, "coding-operational-HR-...-interview-questions" is too long name for a repository.
19 |
20 | ### Should I be familiar with all the tools/platforms/... listed in this repository?
21 |
22 | NO NO NO! :)
23 | I won't give you the crap of "DevOps is a culture, not a role" kind of stuff but one thing is for sure, DevOps is not about being familiar with all the existing tools.
24 |
25 | With that being said, there are some concepts, tools, platforms, ... that are quite common in jobs requirements. Take Linux for example, while Linux is not part of 100% of DevOps roles out there, it's still quite a desired skill and probably appear as a requirement in more than 80% of DevOps roles if I had to guess. So go learn some Linux ;)
26 |
27 | ### How should I prepare for my DevOps interview?
28 |
29 | Excellent question. This repository alone will not be enough in many cases. We are exploring the answer to this question [here](prepare_for_interview.md)
30 | If you have any ideas, insights, questions, ... please contribute :)
31 |
32 | ### How do I become a better DevOps Engineer?
33 |
34 | That's even a better question than the previous one.
35 | I don't have a definitive answer for this question, but what I feel works for me is to read, practice and share (One of the reasons this project was created).
36 | I've gathered some resources, on different topics, [here](http://devopsbit.com/devops-resources)
37 |
38 | ### Why most of the questions don't have answers?
39 |
40 | Because we need more contributors ;)
41 | Also because the maintainer really likes to ask questions and less answering them.
42 |
43 | ### Where the questions and answers are coming from?
44 |
45 | Well, from everywhere - past experience, colleagues, contributors, ... But we do not allow copying interview questions from interview questions sites. There are people who worked hard on adding those to their sites and we respect that.
46 |
47 | ### What are top DevOps skills required for being a DevOps Engineer?
48 |
49 | It's a hard question and the reason is that if you'll ask 20 different people, you'll probably get at least 10 different answers but here what you can check and see for yourself if going over jobs postings:
50 |
51 | * DevOps require you good understanding of operating system concepts. The level required is mainly depends on the company
52 | * Coding is part of DevOps. The level again depends on the company. Some will require you to know basic level of scripting while others deep understanding of common algorithms, data structure, design patterns etc.
53 | * Cloud and Containers - while not 100% must in all companies/positions, this skill is on the rise every year and many (if not most) of the positions/companies require this skill. This specifically means: AWS/Azure/GCP, Docker, Kubernetes, ...
54 |
55 | ### I feel like there are some questions that shouldn't be included in this project
56 |
57 | Is that a question?
58 | In any case, if you don't like some/most of the questions or think that some questions should be removed you can open an issue or submit a PR and we can discuss it there :)
59 |
60 | ### Can I add questions and/or answers to this project?
61 |
62 | I'll simply imagine you didn't ask that on an open source project...
63 |
--------------------------------------------------------------------------------
/credits.md:
--------------------------------------------------------------------------------
1 | ## Credits
2 |
3 | Jenkins logo created by Ksenia Nenasheva and published through jenkins.io is licensed under cc by-sa 3.0
4 | Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License
5 | Terraform logo created by Hashicorp®
6 | Docker logo created by Docker®
7 | The Python logo is a trademark of the Python Software Foundation®
8 | Puppet logo created by Puppet®
9 | Bash logo created by Prospect One
10 | OpenStack logo created by and a trademark of The OpenStack Foundation®
11 | Linux, Kubernetes and Prometheus logos are trademarks of The Linux Foundation®
12 | Mongo logo is a trademark of Mongo®
13 |
--------------------------------------------------------------------------------
/images/ansible.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/ansible.png
--------------------------------------------------------------------------------
/images/bash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/bash.png
--------------------------------------------------------------------------------
/images/cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/cloud.png
--------------------------------------------------------------------------------
/images/coding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/coding.png
--------------------------------------------------------------------------------
/images/devops.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/devops.png
--------------------------------------------------------------------------------
/images/docker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/docker.png
--------------------------------------------------------------------------------
/images/elastic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/elastic.png
--------------------------------------------------------------------------------
/images/general.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/general.png
--------------------------------------------------------------------------------
/images/git.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/git.png
--------------------------------------------------------------------------------
/images/jenkins.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/jenkins.png
--------------------------------------------------------------------------------
/images/kubernetes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/kubernetes.png
--------------------------------------------------------------------------------
/images/linux.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/linux.png
--------------------------------------------------------------------------------
/images/mongo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/mongo.png
--------------------------------------------------------------------------------
/images/monitoring.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/monitoring.png
--------------------------------------------------------------------------------
/images/network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/network.png
--------------------------------------------------------------------------------
/images/openshift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/openshift.png
--------------------------------------------------------------------------------
/images/openstack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/openstack.png
--------------------------------------------------------------------------------
/images/prometheus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/prometheus.png
--------------------------------------------------------------------------------
/images/puppet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/puppet.png
--------------------------------------------------------------------------------
/images/python.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/python.png
--------------------------------------------------------------------------------
/images/scenarios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/scenarios.png
--------------------------------------------------------------------------------
/images/security.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/security.png
--------------------------------------------------------------------------------
/images/sql.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/sql.png
--------------------------------------------------------------------------------
/images/terraform.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hadisinaee/devops-interview-questions/7da83f09581adbd57f41b59c0c0ba3f5f14dec5b/images/terraform.png
--------------------------------------------------------------------------------
/prepare_for_interview.md:
--------------------------------------------------------------------------------
1 | ## How to prepare for an DevOps interview?
2 |
3 | Note: the following suggestions are opinionated
4 |
5 | ### Prepare by answering interview questions
6 |
7 | Make a sample list of interview questions on different topics: technical, company, role, ... and try to answer them. See if you can manage answering them in a fluent, detailed way.
8 |
9 | ### Coding
10 |
11 | Some (if not most) DevOps interviews include coding tasks/questions. Be prepared for those by doing actual coding.
12 | Also, the following probably clear to most people but still, when given the chance to choose any language for answering questions or coding tasks, choose the one you have experience with and not the one the company is using or you think it's using.
13 |
14 | ### Know your resume
15 |
16 | It may sounds strange but the idea here is simple: be ready to answer any question regarding any line you included in your resume.
17 | Sometimes candidates surprised when they are asked on a skill or line which seems to be not related to the position but the simple truth is: if you mentioned something on your resume, it's only fair to ask you about it.
18 |
19 | ### Know the company
20 |
21 | Be familiar with the company you are interviewing at. Some ideas:
22 |
23 | * What the company does
24 | * What products it has
25 | * Major achievements
26 |
27 | ### Books
28 |
29 | From my experience this is not done by many candidates but it's one of the best ways to deep dive into topics like operating system, virtualization, scale, distributed systems, ...
30 |
31 | In most cases, you will do fine with reading books but for the AAA interviews (hardest level) you'll want to read some books and overall, if you inspire to be better DevOps Engineer, books is a great way.
32 |
33 | ### Scenarios
34 |
35 | This is a very common way to interview today for DevOps roles. The candidate is given a task which represents a common task of DevOps Engineers or common knowledge and the candidate has several hours or days to accomplish the task.
36 |
37 | This is a great way to prepare to interviews and I recommend to try it out before actually interviewing. How? take requirements from job posts and convert them to scenarios. Let's see an example:
38 |
39 | "Knowledge in CI/CD" -> Scenario: create a CI/CD pipeline for a project.
40 |
41 | At this point some people ask: "but what project? I'm not working right now" and the answer is: what about GitHub? it has only 9125912851285192 projects...and a free way to set up CI to any of them.
42 |
43 | Let's convert another scenario:
44 |
45 | "Experience with provisioning servers" -> Scenario: provision a server (to make it more interesting, create
46 |
47 | And the last example:
48 |
49 | "Experience with scripting" -> Scenario: write a script which helps to accomplish some of the DevOps goals. For example, a script for generating Travis YAML for projects based on their content. If you need more ideas, open an issue and we'll help!
50 |
51 | ### Start your own DevOps project
52 |
53 | Starting a DevOps is a good idea because:
54 |
55 | * It will make you practice coding
56 | * It will be something you can add to your resume and talk about with the interviewer
57 | * Depends on size and complexity, it can teach you a thing or two about design
58 | * Depends on adoption, it can you teach you a lot about managing Open Source projects
59 |
60 | ### Consider starting in non-DevOps position
61 |
62 | Landing DevOps as a first position can be challenging. No, it's not impossible but still, since DevOps covers many different practices, tools, ... it can be quite challanging.
63 |
64 | A possible path to become a DevOps engineer is to start with actually a different position and switch from there. Some ideas:
65 |
66 | * Linux System Administrator - This is perfect because every DevOps Engineer should have solid understanding of the OS.
67 | * Software Developer/Engineer - A DevOps should have coding skills and this position will provide more than the required knowledge
68 | * QA Engineer - This is more tricky one because IMHO there are less overlapping areas/skills with DevOps Engineer but some people done it so it's not impossible :)
69 |
--------------------------------------------------------------------------------
/scenarios/ansible_minikube_docker.md:
--------------------------------------------------------------------------------
1 | ## Ansible, Minikube and Docker
2 |
3 | * Write a simple program in any language you want that outputs "I'm on %HOSTNAME%" (HOSTNAME should be the actual host name on which the app is running)
4 | * Write a Dockerfile which will run your app
5 | * Create the YAML files required for deploying the pods
6 | * Write and run an Ansible playbook which will install Docker, Minikube and kubectl and then create a deployment in minikube with your app running.
7 |
--------------------------------------------------------------------------------
/scenarios/ci_for_open_source_project.md:
--------------------------------------------------------------------------------
1 | ## CI for Open Source Project
2 |
3 | 1. Choose an open source project from Github and fork it
4 | 2. Create a CI pipeline/workflow for the project you forked
5 | 3. The CI pipeline/workflow will include anything that is relevant to the project you forked. For example:
6 | * If it's a Python project, you will run PEP8
7 | * If the project has unit tests directory, you will run these unit tests as part of the CI
8 | 4. In a separate file, describe what is running as part of the CI and why you chose to include it. You can also describe any thoughts, dilemmas, challenge you had
9 |
10 | ### Bonus
11 |
12 | Containerize the app of the project you forked using any containerization technology you want.
13 |
--------------------------------------------------------------------------------
/scenarios/cloud_slack_bot.md:
--------------------------------------------------------------------------------
1 | ## Cloud Slack Bot
2 |
3 | Create a slack bot to manage cloud instances. You can choose whatever cloud provider you want (e.g. Openstack, AWS, GCP, Azure)
4 | You should provide:
5 |
6 | * Instructions on how to use it
7 | * Source code of the slack bot
8 | * A running slack bot account or a deployment script so we can test it
9 |
10 | The bot should be able to support:
11 |
12 | * Creating new instances
13 | * Removing existing instances
14 | * Starting an instance
15 | * Stopping an instance
16 | * Displaying the status of an instance
17 | * List all available instances
18 |
19 | The bot should also be able to show help message.
20 |
--------------------------------------------------------------------------------
/scenarios/elk_kibana_aws.md:
--------------------------------------------------------------------------------
1 | # Elasticsearch, Kibana and AWS
2 |
3 | Your task is to build an elasticsearch cluster along with Kibana dashboard on one of the following clouds:
4 |
5 | * AWS
6 | * OpenStack
7 | * Azure
8 | * GCP
9 |
10 | You have to describe in details (preferably with some drawings) how you are going to set it up.
11 | Please describe in detail:
12 |
13 | - How you scale it up or down
14 | - How you quickly (less 20 minutes) provision the cluster
15 | - How you apply security policy for access control
16 | - How you transfer the logs from the app to ELK
17 | - How you deal with multi apps running in different regions
18 |
19 | ## Solution
20 |
21 | One Possible solution can be found [here](solutions/elk_kibana_aws.md)
22 |
--------------------------------------------------------------------------------
/scenarios/jenkins/scripts/jobs_with_string.groovy:
--------------------------------------------------------------------------------
1 | def jobs = Jenkins.instance.items.findAll { job -> job.name =~ /"REMOVE_ME"/ }
2 |
3 | jobs.each { job ->
4 | println job.name
5 | //job.delete()
6 | }
7 |
--------------------------------------------------------------------------------
/scenarios/jenkins/scripts/old_builds.groovy:
--------------------------------------------------------------------------------
1 | def removeOldBuilds(buildDirectory, days = 14) {
2 |
3 | def wp = new File("${buildDirectory}")
4 | def currentTime = new Date()
5 | def backTime = currentTime - days
6 |
7 | wp.list().each { fileName ->
8 | folder = new File("${buildDirectory}/${fileName}")
9 | if (folder.isDirectory()) {
10 | def timeStamp = new Date(folder.lastModified())
11 | if (timeStamp.before(backTime)) {
12 | folder.delete()
13 | }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/scenarios/jenkins_pipelines.md:
--------------------------------------------------------------------------------
1 | ## Jenkins Pipelines
2 |
3 | Write/Create the following Jenkins pipelines:
4 |
5 | * A pipeline which will run unit tests upon git push to a certain repository
6 | * A pipeline which will do to the following:
7 |
8 | * Provision an instance (can also be a container)
9 | * Configure the instance as Apache web server
10 | * Deploy a web application on the provisioned instance
11 |
--------------------------------------------------------------------------------
/scenarios/jenkins_scripts.md:
--------------------------------------------------------------------------------
1 | ## Jenkins Scripts
2 |
3 | Write the following scripts:
4 |
5 | * Remove all the jobs which include the string "REMOVE_ME" in their name
6 | * Remove builds older than 14 days
7 |
8 | ### Answer
9 |
10 | * [Remove jobs which include specific string](jenkins/scripts/jobs_with_string.groovy)
11 | * [Remove builds older than 14 days](jenkins/scripts/old_builds.groovy)
12 |
--------------------------------------------------------------------------------
/scenarios/solutions/elk_kibana_aws.md:
--------------------------------------------------------------------------------
1 | # Elasticsearch, Kibana and AWS - Solution
2 |
3 | This one out of many possible solutions. This solution is relying heavily on AWS.
4 |
5 | * Create a VPC with subnet so we can place Elasticsearch node(s) in internal environment only.
6 | If required, we will also setup NAT for public access.
7 |
8 | * Create an IAM role for the access to the cluster. Also, create a separate role for admin access.
9 |
10 | * To provision the solution quickly, we will use the elasticsearch service directly from AWS for production deployment.
11 | This way we also cover multiple AZs. As for authentication, we either use Amazon cognito or the organization LDAP server.
12 |
13 | * To transfer data, we will have to install logstash agent on the instances. The agent will be responsible
14 | for pushing the data to elasticsearch.
15 |
16 | * For monitoring we will use:
17 |
18 | * Cloud watch to monitor cluster resource utilization
19 | * Cloud metrics dashboard
20 |
21 | * If access required from multiple regions we will transfer all the data to S3 which will allow us to view the data
22 | from different regions and consolidate it in one dashboard
23 |
--------------------------------------------------------------------------------
/scenarios/write_dockerfile_run_container.md:
--------------------------------------------------------------------------------
1 | # Write a Dockerfile and run a container
2 |
3 | Your task is as follows:
4 |
5 | 1. Create a Docker image:
6 | * Use centos or ubuntu as the base image
7 | * Install apache web server
8 | * Deploy any web application you want
9 | * Add https support (using HAProxy as reverse-proxy)))
10 | 2. Once you wrote the Dockerfile and created an image, run the container and test the application. Describe how did you test it and provide output
11 | 3. Describe one or more weakness of your Dockerfile. Is it ready to be used in production?
12 |
--------------------------------------------------------------------------------
/scripts/count_questions.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo $((7 + $(cat README.md | grep \<\/summary\> | wc -l)))
4 |
--------------------------------------------------------------------------------