In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1.nodeport and ClusterIPapiVersion: v1kind: Service#apiVersion: v1#kind: Servivemetadata: name: nginx-svc namespace: defaultspec: type: NodePort # define the type as NodePort selector: # tag selection, write the tag of the backend to be forwarded in the following app: nginx ports:-port: 80 # service port targetPort: 80 # container port nodePort: 30080 # node port, not required for ClusterIP Or if it is left empty, it will be random-apiVersion: v1kind: Podmetadata: name: ng1 labels: app: webspec: containers:-name: ng1 image: hub.c.163.com/library/nginx imagePullPolicy: IfNotPresent
The usage of nodeport and ClusterIP is almost the same as the type, and ClusterIP does not need to fill in nodePort.
Deployment controller apiVersion: v1kind: Servicemetadata:name: nginx-svcnamespace: defaultspec:type: NodePort# definition type is NodePortselector:# tag selection. Write the tag of the backend to be forwarded in the following app: webports:- port: 90 # service port targetPort: 80 # container port nodePort: 30080 # node port. This section of ClusterIP is not required. You can also leave it unfilled and it will be random-apiVersion: apps/v1kind: Deploymentmetadata:name: nginxspec:replicas: launch two containers: selector: matchLabels: app: nginx# matching tag template:#. The following is written as metadata: labels: app: nginxspec: containers:-name: ng1 image: hub.c.163.com/. Library/nginx imagePullPolicy: IfNotPresent2.daemonset controller and service headless service apiVersion: apps/v1kind: DaemonSet# controller type dae... This controller will launch a container with the following tag matching for each node node. Except metadata: name: nginx-daemonset namespace: defaultspec: selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers:-name: nginx image: "ikubernetes/myapp:v1"-apiVersion: v1kind: Servicemetadata: name: nginx-service namespace: defaultspec: selector: app: nginx clusterIP: None ports:-port: 80 targetPort: 80
Service's headless service is suitable for scenarios where some services directly establish a connection with the backend container.
[root@cs25] # kubectl get pod-l app=myapp-o wideNAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATESmyapp-deploy-6c7db749dd-4kjdh 1 Running 0 31m 192.168.94.170 cs27 myapp-deploy-6c7db749dd-x95d6 1 Running 0 31m 192.168.100.2 cs25 # check the IP [root @ cs25 ~] # dig nginx-service.default.svc.cluster.local of two backend containers DiG 9.9.4-RedHat-9.9.4-72.el7 nginx-service.default.svc.cluster.local;; global options: + cmd;; Got answer:;;-> > HEADER
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.