kubectl apply
does not apply since the file does not change, below is the content mci.yaml
(just for reference, not essential).
apiVersion: networking.gke.io/v1
kind: MultiClusterIngress
metadata:
name: terraback-ingress
namespace: terraback
spec:
template:
spec:
backend:
serviceName: terraback-mcs
servicePort: 4000
Below is the command and response
(base) PS D:\terraform_small\terra-back> kubectl apply -f mci.yaml
multiclusteringress.networking.gke.io/terraback-ingress unchanged
But I need it to force apply, since terraback-mcs
has changed, but is there a way to force apply despite no changes with kubectl apply
?
In this case, you do not need to update the Ingress spec since neither the service name nor port has changed. But if you really to force a replacement, you can try: kubectl replace -f mci.yaml --force
Below is the command and response
(base) PS D:\terraform_small\terra-back> kubectl apply -f mci.yaml
-f
doesn't mean force - it means file, you need --force
, so:
kubectl apply -f mci.yaml --force
See apply docs :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.