Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the mode of Restful API consumption in CloudFoundry command line and Kubernetes command line?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you the "CloudFoundry command line and Kubernetes command line how Restful API consumption is like", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "CloudFoundry command line and Kubernetes command line in how Restful API consumption is like" this article.

Let's start with CloudFoundry's command line tool CLI. We work in CloudFoundry, and the first command we use is cf login.

If you maintain the value of CF_TRACE as true in the environment variable:

Then we can find that commands such as cf login are actually done by consuming Restful API.

The following figure shows the details of the api endpoint request for cf login command for your reference:

API endpoint: https://api.cf.eu10.hana.ondemand.com

REQUEST: [2018-09-21T14:50:57+08:00]

GET / v2/info HTTP/1.1

Host: api.cf.eu10.hana.ondemand.com

Accept: application/json

Content-Type: application/json

User-Agent: go-cli 6.36.1+e3799ad7e.2018-04-04 / windows

RESPONSE: [2018-09-21T14:50:59+08:00]

HTTP/1.1 200 OK

Connection: close

Content-Length: 550

Content-Type: application/json;charset=utf-8

Date: Fri, 21 Sep 2018 06:50:58 GMT

Server: nginx

X-Content-Type-Options: nosniff

X-Vcap-Request-Id: abf32f52-294a-41f5-5919-be948d78f0dd::a32b17bb-da82-4d45-930f-f0344c8a83b3

{"name": "," build ":", "support": "," version ": 0," description ":" Cloud Foundry at SAP Cloud Platform "," authorization_endpoint ":" https://login.cf.eu10.hana.ondemand.com "," token_endpoint ":" [PRIVATE DATA HIDDEN] "," min_cli_version ": null," min_recommended_cli_version ": null," api_version ":" 2.115.0 " "app_ssh_endpoint": "ssh.cf.eu10.hana.ondemand.com:2222", "app_ssh_host_key_fingerprint": "f3:12:47:b5:3a:19:6e:6c:4e:9d:90:2e:6f:8e:87:cc", "app_ssh_oauth_client": "ssh-proxy", "doppler_logging_endpoint": "wss://doppler.cf.eu10.hana.ondemand.com:443"}

REQUEST: [2018-09-21T14:50:59+08:00]

GET / login HTTP/1.1

Host: login.cf.eu10.hana.ondemand.com

Accept: application/json

Content-Type: application/json

User-Agent: go-cli 6.36.1+e3799ad7e.2018-04-04 / windows

API response result:

RESPONSE: [2018-09-21T14:51:00+08:00]

HTTP/1.1 200 OK

Connection: close

Content-Length: 551

Cache-Control: no-store

Content-Language: en-US

Content-Type: application/json;charset=UTF-8

Date: Fri, 21 Sep 2018 06:50:59 GMT

Set-Cookie: Xmuri UaamurCsrffang 8uoxBvyG8QCwo29efrrZNh; Max-Age=86400; Expires=Sat, 22-Sep-2018 06:51:00 GMT; Path=/; Secure; HttpOnly

Strict-Transport-Security: max-age=31536000; includeSubDomains

X-Content-Type-Options: nosniff

X-Frame-Options: DENY

X-Vcap-Request-Id: f6b29d8f-f78e-4c5e-61f3-5c9d906828ed

X-Xss-Protection: 1; mode=block

{"app": {"version": "4.19.0"}, "links": {"uaa": "https://uaa.cf.eu10.hana.ondemand.com", "passwd": "https://accounts.sap.com/ui/createForgottenPasswordMail?spName=cf.eu10.hana.ondemand.com", "login": "https://login.cf.eu10.hana.ondemand.com", "register": "https://accounts.sap.com/ui/public/showRegisterForm?spName=cf.eu10.hana.ondemand.com"} "zone_name": "uaa", "entityID": "login.cf.eu10.hana.ondemand.com", "commit_id": "7897100", "idpDefinitions": {}, "prompts": {"username": ["text", "Email"], "password": ["password", "Password"]}, "timestamp": "2018-06-13T12:02:09-0700"}

Email >

And look at Kubernetes. We use a lot of orders:

Kubectl get pods, return the pods list.

Restful API consumption mode of CloudFoundry command line and Kubernetes command line

Instead of using the command line

Kubectl-- VIP8 get pods

It is found that the get pods command is actually the API server that sends the request to Kubernetes:

Https://:6443/api/v1/namespaces/default/pods?limit=500

The details of API requests are as follows:

API server is one of the most important core components of Kubernetes:

1. Provide REST API interface for cluster management, including authentication and authorization, data verification and cluster status change, etc.

two。 Provides a hub for data exchange and communication between other modules (other modules are queried or modified through API Server

Data, only API Server directly manipulates etcd)

Kube-apiserver supports both https (default listening on port 6443) and http API (default listening in

Port 8080 of 127.0.0.1), where http API is a non-secure interface, does not do any authentication and authorization mechanism, and is not recommended

The production environment is enabled. The REST API format provided by both APIs is the same. For more information, please see Kubernetes API Reference.

Look at all the API call formats.

In practical use, apiserver is usually accessed through kubectl, or through Kubernetes's

Client library to access apiserver.

For example, the document of the API corresponding to the above get pods command:

Https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#list-62

These are all the contents of this article entitled "what is the way Restful API is consumed on the CloudFoundry command line and the Kubernetes command line?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report