Code Monkey home page Code Monkey logo

14.2-clokub-homeworks's Introduction

Задача 1: Работа с модулем Vault

Cоздали под с Vault через предложенный yaml.
затем выяснили ip проверили ключ в переменных пода.

desema@control1:~$ kubectl get pod 14.2-netology-vault -o json | jq -c '.status.podIPs'
[{"ip":"10.233.110.37"}]
desema@control1:~$ kubectl exec --stdin --tty 14.2-netology-vault -- sh
/ # env | grep TOKEN
VAULT_DEV_ROOT_TOKEN_ID=aiphohTaa0eeHei


Далее подняли pod на базе fedora, установили в него python и попробовали подключиться к нашему Vault, а так же записали и прочитали секрет, использовав токен и ip полученные выше:

>>> client = hvac.Client(
...     url='http://10.233.110.37:8200',
...     token='aiphohTaa0eeHei'
... )
>>>
>>> client.is_authenticated()
True
>>>
>>> client.secrets.kv.v2.create_or_update_secret(
...     path='hvac',
...     secret=dict(SecretKey='SecretValue!'),
... )
{'request_id': '4bdf1aeb-6ead-4839-4f6d-e935e15951f8', 'lease_id': '', 'renewable': False, 'lease_duration': 0, 'data': {'created_time': '2021-11-30T16:32:47.492895716Z', 'custom_metadata': None, 'deletion_time': '', 'destroyed': False, 'version': 2}, 'wrap_info': None, 'warnings': None, 'auth': None}
>>>
>>> client.secrets.kv.v2.read_secret_version(
...     path='hvac',
... )
{'request_id': '7b3e3993-566e-b42c-4b15-500ca6ca2e71', 'lease_id': '', 'renewable': False, 'lease_duration': 0, 'data': {'data': {'SecretKey': 'SecretValue!'}, 'metadata': {'created_time': '2021-11-30T16:32:47.492895716Z', 'custom_metadata': None, 'deletion_time': '', 'destroyed': False, 'version': 2}}, 'wrap_info': None, 'warnings': None, 'auth': None}
>>>

14.2-clokub-homeworks's People

Contributors

desemas7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.