In the test server for docker learning, some centos7 software installation and their own server is not compatible so lead to yun download software when the error: Error: xz compression not available
For the error solution.
rm -fr /var/cache/yum/x86_64/6/epel/
rm -rf /etc/yum.repos.d/epel*
Reinstall epel and base
wget -O/etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-7.repo
yum repolist
Category Archives: Error
Kubernetes reported an error: matchexpressions: [] v1. Labelselector requirement (NIL)}: field is immutable
error message
MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
Reason
reason: the essential reason for this problem is that two identical Deployment (one deployed and one to deploy) have different selectors.
scene duplicate
case:
app.yaml
apiVersion: apps/v1 kind: Deployment
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 10
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
version: v1.0.0
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9101"
spec:
containers:
- name: my-app
image: containersol/k8s-deployment-strategies
ports:
- name: http
containerPort: 8080
- name: probe
containerPort: 8086
env:
- name: VERSION
value: v1.0.0
livenessProbe:
httpGet:
path: /live
port: probe
initialDelaySeconds: 5
periodSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: probe
periodSeconds: 5
after deployment, take a look at the results
$kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
my-app 10/10 10 10 84s
Next, we modify the selector of deployment, which mainly reads </p b>
spec:
replicas: 10
selector:
matchLabels:
app: my-app-change
template:
metadata:
labels:
app: my-app-change
version: v1.0.0
the completion file is as follows :
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 10
selector:
matchLabels:
app: my-app-change
template:
metadata:
labels:
app: my-app-change
version: v1.0.0
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9101"
spec:
containers:
- name: my-app
image: containersol/k8s-deployment-strategies
ports:
- name: http
containerPort: 8080
- name: probe
containerPort: 8086
env:
- name: VERSION
value: v1.0.0
livenessProbe:
httpGet:
path: /live
port: probe
initialDelaySeconds: 5
periodSeconds: 5
readinessProbe:
httpGet:
path: /ready
port: probe
periodSeconds: 5
When kubectl is deployed, the following error occurs:
$kubectl apply -f app.yaml
The Deployment "my-app" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app":"my-app-change"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
and you can see the selector for deployed:
$kubectl describe deployment my-app
Name: my-app
...
Selector: app=my-app
...
you can see that the deployment name my-app already has a selector and the content is app=my-app. At this time, the reason for the error is that the name of the newly deployed deployment is also MY-app, but the content of the selector is APP = My-app-change.
solution:
1: you can delete the original deployment and then deploy
2: modify the name of deployment instead of repeating
Android 10 open file exception open failed: eacces (permission denied) android:requestLegacyExternalStorage= “true“
in Android development, we generally use the following code to get the storage path, and the results are generally /storage/emulated/0
in AndroidManifest. Application node in the XML file with the android: requestLegacyExternalStorage = “true” attribute, as follows: </ p>
<application
android:requestLegacyExternalStorage="true"
may be easy for developers, but for those who are new to android, it doesn’t use
now most mobile phones are Android version 10.0, when reading and writing files to the memory card, the problem of: open failed: EACCES (Permission denied) will occur. After adding the above one sentence of code to baidu, it has not been solved. The possible reason is that there is no dynamic access Permission added in the code snippet
dynamic read and write permission code:
final int REQUEST_EXTERNAL_STORAGE = 1;
if (ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 101);
} else {
//downloadFile();
/**
* Write the code you want to execute here
*/
}
Where is
used?
for example, we now have a button, we get its click event in the Activity, click we want to add a photo in: /storage/emulated/0/DCIM, we want to perform the operation in else can
example:
no dynamic permissions added:
utils_get.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getDataFromokHttpUtils();
}
});
add dynamic permissions:
utils_down.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final int REQUEST_EXTERNAL_STORAGE = 1;
String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE };
if (ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 101);
} else {
downloadFile();
}
}
});
</ div>