我看到我可以使用“ kubectl set image”命令来更新部署中使用的容器,如下所示:
in .HTML file ``` <canvas #lineCanvas></canvas> ```
in .TS file ```
import { Component, ViewChild, OnInit } from '@angular/core';
import { NavController, MenuController, NavParams, ToastController } from 'ionic-angular';
import { Chart } from 'chart.js';
import { DashboardProvider } from '../../providers/dashboard/dashboard';
import { tokenKey } from '@angular/core/src/view';
@Component({
selector: 'page-dashboard',
templateUrl: 'dashboard.html',
providers: [DashboardProvider]
})
export class DashboardPage implements OnInit {
@ViewChild('lineCanvas') lineCanvas;
lineChart: any;
GetAthleteScoreByTest : any;
constructor(public navCtrl: NavController,
private dashApis: DashboardProvider) {
}
ngOnInit() {
this.dashApis.GetAthleteScoreByTest(ACCESS_TOKEN)
.subscribe(
(response) => {
this.GetAthleteScoreByTest = response["data"];
let labels = ['0'];
let data = [0];
let i = 1;
this.GetAthleteScoreByTest.forEach(element => {
data.push(element["AthleteScore"]);
labels.push(i.toString());
++i;
});
this.lineChart = new Chart(this.lineCanvas.nativeElement, {
type: 'line',
data: {
labels: labels,
datasets: [
{
label: "Score Comparision",
fill: false,
lineTension: 0.1,
backgroundColor: "rgba(75,192,192,0.4)",
borderColor: "rgba(75,192,192,1)",
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: "rgba(75,192,192,1)",
pointBackgroundColor: "#fff",
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: "rgba(75,192,192,1)",
pointHoverBorderColor: "rgba(220,220,220,1)",
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: data,
spanGaps: false,
}
]
}
});
},
(error) => {
}
);
}
}
但是,在某些情况下,我还想使用其他启动命令。有没有办法同时更新图像和用于容器的命令?
答案 0 :(得分:2)
您可以使用kubectl patch
。运行kubectl patch --help
来获取文档,但据我所知,应该这样做:
$ kubectl patch deployment <your-deployment> -p '
spec:
template:
spec:
containers:
- name: <container-name>
command: ["new", "command"]
'