在服务中发出http请求时,我收到此响应。
这是登录组件
export class LoginComponent {
credentials: Credentials;
constructor(
private auth: AuthService,
@Inject(UserService) private userService: UserService,
@Inject(HttpClient) private http: HttpClient,
private auth0: Auth0Service
) {}
onLogin(credentials) {
const sendReq = this.userService.login(credentials);
}
Run Code Online (Sandbox Code Playgroud)
我在App.module的提供程序中添加了UserService
这是UserService
@Injectable()
export class UserService {
constructor(
@Inject(Auth0Service) private authService: Auth0Service,
protected http: HttpClient // @Inject(HttpClient) protected http: HttpClient
) {}
login(credentials): Observable<any> {
console.log(credentials);
console.log(credentials.username);
this.http
.post("http://localhost:3000/api/Users/login", {
username: credentials.username,
password: credentials.password
})
.subscribe(
data => {
console.log(data);
},
err => {
console.log("Something went wrong!");
console.log(err); …Run Code Online (Sandbox Code Playgroud) 我已经在 Kubernetes 上设置了一个 Node 应用程序。我正在运行一个副本,并且我希望在更新映像时停机时间为 0。我set Image在 Kubernetes 上更新了我的 Pod 。
'set', 'image', 'deployment/dev-web'
Run Code Online (Sandbox Code Playgroud)
这是我的 YAML 文件
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "2"
generation: 2
labels:
io.kompose.service: dev-web
name: dev-web
namespace: default
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: dev-web
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: dev-web
spec:
containers:
- env:
image: gcr.io/my-project-link/my-image-link
imagePullPolicy: Always
name: dev-web-container
ports:
- containerPort: 2000
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: / …Run Code Online (Sandbox Code Playgroud) 我想要回滚我的 Pod 部署。我正在set ImageCI 环境中使用更新我的 pod。当我将 Deployment/web 文件上的 maxUnavailable 设置为 1 时,我会出现停机情况。但是当我将 maxUnavailable 设置为 0 时,pod 不会被替换,容器/应用程序也不会重新启动。
另外,我在 Kubernetes 集群中有一个节点,这是它的信息
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
CPU Requests CPU Limits Memory Requests Memory Limits
------------ ---------- --------------- -------------
881m (93%) 396m (42%) 909712Ki (33%) 1524112Ki (56%)
Events: <none>
Run Code Online (Sandbox Code Playgroud)
这是完整的 YAML 文件。我确实有就绪探针组。
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "10"
kompose.cmd: C:\ProgramData\chocolatey\lib\kubernetes-kompose\tools\kompose.exe
convert
kompose.version: 1.14.0 (fa706f2)
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Deployment","metadata":{"annotations":{"kompose.cmd":"C:\\ProgramData\\chocolatey\\lib\\kubernetes-kompose\\tools\\kompose.exe convert","kompose.version":"1.14.0 (fa706f2)"},"creationTimestamp":null,"labels":{"io.kompose.service":"dev-web"},"name":"dev-web","namespace":"default"},"spec":{"replicas":1,"strategy":{},"template":{"metadata":{"labels":{"io.kompose.service":"dev-web"}},"spec":{"containers":[{"env":[{"name":"JWT_KEY","value":"ABCD"},{"name":"PORT","value":"2000"},{"name":"GOOGLE_APPLICATION_CREDENTIALS","value":"serviceaccount/quick-pay.json"},{"name":"mongoCon","value":"mongodb://quickpayadmin:quickpay1234@ds121343.mlab.com:21343/quick-pay-db"},{"name":"PGHost","value":"173.255.206.177"},{"name":"PGUser","value":"postgres"},{"name":"PGDatabase","value":"quickpay"},{"name":"PGPassword","value":"z33shan"},{"name":"PGPort","value":"5432"}],"image":"gcr.io/quick-pay-208307/quickpay-dev-node:latest","imagePullPolicy":"Always","name":"dev-web-container","ports":[{"containerPort":2000}],"readinessProbe":{"failureThreshold":3,"httpGet":{"path":"/","port":2000,"scheme":"HTTP"},"initialDelaySeconds":5,"periodSeconds":5,"successThreshold":1,"timeoutSeconds":1},"resources":{"requests":{"cpu":"20m"}}}]}}}}
creationTimestamp: 2018-12-24T12:13:48Z
generation: …Run Code Online (Sandbox Code Playgroud)